(展示的时候,只会展示分组记录的第一条记录),分组时,一般会结合使用count()、max()、min()、avg()、sum()函数。...;
sql语句的意思是:my_student表以c_id进行分组,然后显示分组后的每组的c_id名称、每组的总数、每组的最高、最低、平均身高和每组的年龄总和。...B、多字段分组
select c_id,sex,count(*),max(height),min(height),avg(height),sum(age)from my_student group by...C、多字段分组(加上显示每组的某一字段的所有数据)
selectc_id,sex,count(*),max(height),min(height),avg(height),sum(age) ,GROUP_CONCAT...(name)from my_student group by c_id ,sex;
④[having 子句]:having的作用类同where,而且having能做几乎所有where能做的事情,而where