1.FROM calculates the Cartesian product on the left table of the From and the table on the right. Generating a virtual table VT1
2.ON VT1 on the virtual table, only those rows that match <join-condition> will be recorded in the virtual table VT2.
3.JOIN if a outer join is specified (such as a LEFT JOIN or right join), rows that are not matched in the reserved table are added to the virtual table VT2 as an outer row, resulting in a virtual table VT3, which contains more than two tables in the rug FROM clause. Then the result of the previous join connection VT3 and the next table repeat steps three steps, until all the tables have been processed.
4.WHERE a WHERE condition filter for virtual table VT3. Only records that match <where-condition> will be inserted into the virtual table VT4.
5.GROUP by grouping records in VT4 according to the columns in the GROUP BY clause, generating VT5.
The 6.WITH cube or with ROLLUP the table VT5 with a cube or ROLLUP operation, resulting in a table VT6.
7.HAVING applies a having filter to the virtual table VT6, only records that match
8.SELECT performs a select operation, selects the specified column, and inserts it into the virtual table VT8.
9.DISTINCT VT8 the records in the Generates virtual table VT9.
10.ORDER by sorts the records in the virtual table VT9 by <order_by_list>, generating the virtual table VT10.
11.TOP takes a record of the specified row, generates a virtual table VT11, and returns the result.
"Go" MySQL statement execution order