2 - MySQL:SQL逻辑查询语句执行顺序

MySQL:SQL逻辑查询语句执行顺序

一,SELECT语句关键字的定义顺序

SELECT DISTINCT <select_list>
 
FROM <left_table>
 
<join_type> JOIN <right_table>
 
ON <join_condition>
 
WHERE <where_condition>
 
GROUP BY <group_by_list>
 
HAVING <having_condition>
 
ORDER BY <order_by_condition>
 
LIMIT <limit_number>

二,SELECT语句关键字的执行顺序

(7)     SELECT
 
(8)     DISTINCT <select_list>
 
(1)     FROM <left_table>
 
(3)     <join_type> JOIN <right_table>
 
(2)     ON <join_condition>
 
(4)     WHERE <where_condition>
 
(5)     GROUP BY <group_by_list>
 
(6)     HAVING <having_condition>
 
(9)     ORDER BY <order_by_condition>
 
(10)    LIMIT <limit_number>

  

posted @ 2018-10-16 10:58  edison-chen  阅读(221)  评论(0编辑  收藏  举报