SQL execution Order

Source: Internet
Author: User

From: Performs a Cartesian product (Cartesian product) (cross join) on the first two tables in the FROM clause, generating a virtual table VT1
On: Apply an on filter to VT1. Only those lines that make <join_condition> true are inserted into the VT2.
OUTER (Join): If OUTER join is specified (relative to cross join or (INNER join), the reserved table (preserved table: Left outer join marks the left table as a reserved table, right outer join marks the right table as a reserved table, A full outer join that marks two tables as a reserved table) does not find a matching row to be added to VT2 as an outer row, generating VT3. If the FROM clause contains more than two tables, repeat steps 1 through 3 for the result table and the next table that were generated for the previous join until all the tables have been processed.
Where: Apply a where filter to VT3. Only rows that make <where_condition> true are inserted into the VT4.
GROUP BY: Groups the rows in VT4 by the list of columns in the GROUP BY clause, generating VT5.
Having: Apply a having filter to VT6. Only groups that make Select: Processes the select list, producing VT8.
DISTINCT: Removes duplicate rows from VT8, resulting in VT9.
ORDER BY: Generates a cursor (VC10) by sorting the rows in VT9 by the list of columns in the ORDER BY clause.
TOP: Selects the specified number or scale of rows from the beginning of the VC10, generates the table VT11, and returns the caller.

"," "Join", "where"-- T

SELECT DISTINCT Top
From
JOIN
On
WHERE
GROUP by
Having
ORDER by

SQL 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.