select * from emp order by sal;select * from emp order by sal desc;统计函数也叫聚合函数,通常用于求整个表中某列的数据的:总和,平均值,...通常不搭配表中的字段一起查询。sum(),avg(),max()min(),count(*/主键)练习1:求部门编号20中员工的平均工资,工资总和,工资最大值,最小值,人数。...select ename,sum(sal),avg(sal),max(sal),min(sal) ,count(empno),count(comm)from emp where deptno=20;分组...分组后使用聚合函数select sex,count(*) from stu group by sex;注意:如果没有分组,那么聚合函数(sum,count,max,min)作用在整张表上如果有分组,组函数作用在分组后的数据上在写...中使用组函数(max,min,avg,count...)