MySQL statement execution order

The format of the statement we wrote is as follows:

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 >

The MySQL execution sequence is as follows:

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>

Although, the SELECTstatement we wrote is the first, but in the execution order of MySQL, the FROMstatement executed first .
The graphical display is as follows:
MySQL execution order

Guess you like

Origin blog.csdn.net/u013866352/article/details/107941483