对于普通的sql语句,人写的与机读顺序是不同的,且看说明。
人写的sql:
select distinct <select_list> from <left_table> <join_type> join <right_table> on <join_condition> where <where_condition> group by <groupby_list> having <having_condition> order by <orderby_conditoin> limit <limit number>;
机读顺序:
FROM <left_table> ON <join_codition> <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>