A. 基本查询
一,基本语法形式
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002025678-1735771688.jpg)
二,字段或表达式列表
三,all 和 distinct
四,from子句
五,where子句
六,条件语法![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002033865-2065057616.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002034178-91656188.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002034287-1573279543.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002034568-1097934593.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002034850-389580307.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002034990-963797083.png)
七,group by 子句:分组
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002036037-1775676078.jpg)
八,having子句
九,order by 排序子句
十,limit 子句
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002039928-1718609348.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002026006-1632611500.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002026115-448501162.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002026443-451784143.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002026600-1969378234.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002032303-1524223409.jpg)
三,all 和 distinct
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002032475-305303192.jpg)
四,from子句
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002032662-282098556.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002033443-2031793344.jpg)
五,where子句
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002033568-211806155.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002033662-1611509508.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002033756-2125017382.jpg)
六,条件语法
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002033865-2065057616.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002034178-91656188.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002034287-1573279543.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002034475-1707312501.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002034568-1097934593.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002034662-1145683067.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002034850-389580307.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002034990-963797083.png)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002035115-142178170.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002035225-880799479.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002035334-667575879.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002035428-1733662750.jpg)
七,group by 子句:分组
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002035537-146555962.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002036037-1775676078.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002036209-924578768.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002036350-79055026.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002036475-2103252406.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002036568-1984244317.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002037631-1794320924.jpg)
八,having子句
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002037818-1641594164.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002038021-1756422246.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002038178-1021881683.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002038365-386924279.jpg)
九,order by 排序子句
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002038756-1926813700.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002038928-1046641758.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002039100-1301790026.jpg)
十,limit 子句
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002039240-1227027117.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002039365-872695275.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002039459-190612422.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002039568-895292883.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002039662-1614273200.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002039834-670083638.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002039928-1718609348.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002040084-1206921080.jpg)