研磨Mysql之SQL的执行顺序

手写顺序:

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>

电脑解释:

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

发布了59 篇原创文章 · 获赞 2 · 访问量 2082

猜你喜欢

转载自blog.csdn.net/zuodaoyong/article/details/101941367