select column, from table_name [where condition] [group by group_by_condition] [having group_condition] [order by column]; -- 平均工资 select deptno,avg(sal) from emp group by deptno;
错误写法:
1 2
select a,b,avg(x) from emp group by a; -- b必须出现在group by 后面。