ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
### group by ~~~ select gender from students group by gender; ~~~ ### group by + group_concat() ~~~ 分组之后,根据分组结果,使用group_concat()来放置每一组的某字段的值的集合 select gender,group_concat(name) from students group by gender; ~~~ ### group by + having 1. having 条件表达式:用来分组查询后指定一些条件来输出查询结果 2. having作用和where一样,但having只能用于group by ~~~ select gender,count(*) from students group by gender having count(*)>2; ~~~ ### group by + with rollup with rollup的作用是:在最后新增一行,来记录当前列里所有记录的总和 ~~~ select gender,count(*) from students group by gender with rollup; ~~~