select语句定义如下:
<SELECT clause> [<FROM clause>] [<WHERE clause>] [<GROUP BY clause>]
[<HAVING clause>] [<ORDER BY clause>] [<LIMIT clause>]
先给出SQL语句执行顺序结论,后通过案例分析:
Select 6 … 分组函数(avg、sum等) 4 … From 1 … where 2 … group by 3 … having 5 … order by 7 limit 8
select deptno ,avg(sal) from emp where ename is not null group by
deptno having avg(sal)>2000 order by deptno desc;
呜啦啦啦啦 看官喜欢的话点赞收藏或者关注一下吧