常用的语法:select--from--where--group by--having--order by 

1、分组子句group by +con 按什么分组

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。

2、having子句  对上面分组的数据进行再次条件过滤

3、排序子句 order by 

order by  + con ASC  升序   order by  + con desc j降序   

select  con1 ,con2 from ......+ order by  1  按con1排序/+ order by  2  按con2排序

当一个查询语句同时出现了where,group by,having,order by的时候,执行顺序和编写顺序是: 

from -> where  ->group by ->having ->select ->order by

常用函数:

1、统计类函数 count()  sum() avg()

2、分析函数  

OVER(PARTITION BY xxx PORDER BY yyy ROWS )

3、other: nvl()  、listagg()  行转列。。。

编不出来了 ,下次再来

 

扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄