Mysql 学习之 SQL的执行顺序

  • 时间:
  • 浏览:0
  • 来源:SSYCMS

mysql的json查询:

                      

                                                              

              

1、一条普通的SQL

SELECT      <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>

2、Mysql 解析读取后的SQL

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>

mysql解析SQL的时候先从FROM 开始,应为他需要先知道数据来源那些表。

笛卡尔积:A表10条 B表5条 ,笛卡尔积=10*5。