对表进行分组 GROUP BY 指定的列称为聚合键或者分组列 SELECT sid,sname FROM student GROUP BY sid,sname; group by 写在from之后,如果有where写在where之后; group by 与where 连用 SELECT sid,sname FROM student WHERE xi='SC' GROUP BY sid,sname; 执行顺序为:from-> where-> group by->select 并在使用group by 时select子句中不能出现在聚合键之外的列名;在mysql中除外,