2020-07-11
阅读量:
851
复习:SQL分组函数
分组
GROUP BY
格式:select 组函数 from 表 where 条件 group by 字段;
特别的group by 必须在where之后,order by之前
HAVING 组判断条件,它的真假决定一组数据是否返回
格式:select 组函数 from 表 where 条件 group by 字段 having 组判断条件;
select num from tb1 group by num;
select num, id from tb1 group by num, id;
select num, id from tb1 where id > 5 group by num, id order by id desc;
select num, id count(*), sum(score), max(score), min(score) from tb1 group by num, id;
select num from tb1 group by num having max(id) > 10;
————————————————
版权声明:本文为CSDN博主「holysll」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/holysll/article/details/107227402






评论(0)


暂无数据
推荐帖子
0条评论
1条评论
0条评论