"Go" MySQL statement execution order

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.