当前位置:网站首页>面试突击62:group by 有哪些注意事项?
面试突击62:group by 有哪些注意事项?
2022-07-06 09:39:00 【InfoQ】
1.group by 后面不能加 where
- select
- from
- where
- group by
- having
- order by
- limit

- from 阶段
- where 阶段
- group 阶段
- having 阶段
- select 阶段
- order by 阶段
- limit 阶段
2.group by 或 having 可单独使用

3.group by 和 having 可使用别名
drop table if exists student_score;
create table student_score(
id int primary key auto_increment comment '主键',
name varchar(250) comment '姓名',
math decimal(4,1) comment '数学成绩',
chinese decimal(4,1) comment '语文成绩'
);
insert into student_score(name,math,chinese) values('张三',50,50),('李四',80,80),('王五',90,90);



为什么可用别名?
- from 阶段
- where 阶段
- group 阶段
- having 阶段
- select 阶段
- order by 阶段
- limit 阶段

总结
边栏推荐
- Xin'an Second Edition: Chapter 24 industrial control safety demand analysis and safety protection engineering learning notes
- 【MySQL入门】第三话 · MySQL中常见的数据类型
- List set data removal (list.sublist.clear)
- C#WinForm中的dataGridView滚动条定位
- connection reset by peer
- Binary search strategy
- Solution qui ne peut pas être retournée après la mise à jour du navigateur Web flutter
- Grafana 9 正式发布,更易用,更酷炫了!
- 03 products and promotion developed by individuals - plan service configurator v3.0
- 自动化运维利器-Ansible-Playbook
猜你喜欢
Integrated development management platform
Sqoop I have everything you want
yarn : 无法加载文件 D:\ProgramFiles\nodejs\yarn.ps1,因为在此系统上禁止运行脚本
华为认证云计算HICA
Display picture of DataGridView cell in C WinForm
Optimization of middle alignment of loading style of device player in easycvr electronic map
Spark calculation operator and some small details in liunx
pip install pyodbc : ERROR: Command errored out with exit status 1
The NTFS format converter (convert.exe) is missing from the current system
【MySQL入门】第三话 · MySQL中常见的数据类型
随机推荐
mysql高級(索引,視圖,存儲過程,函數,修改密碼)
Error: Publish of Process project to Orchestrator failed. The operation has timed out.
自动化运维利器ansible基础
Kali2021 installation and basic configuration
学 SQL 必须了解的 10 个高级概念
C WinForm series button easy to use
RepPoints:可形变卷积的进阶
[reverse intermediate] eager to try
The art of Engineering (2): the transformation from general type to specific type needs to be tested for legitimacy
Single responsibility principle
Flink analysis (II): analysis of backpressure mechanism
How uipath determines that an object is null
MySQL stored procedure
Xin'an Second Edition: Chapter 25 mobile application security requirements analysis and security protection engineering learning notes
Solid principle
Grafana 9 is officially released, which is easier to use and more cool!
【ASM】字节码操作 ClassWriter 类介绍与使用
Connect to LAN MySQL
基于Infragistics.Document.Excel导出表格的类
Integrated development management platform