SQL statement execution sequence

Source: Internet
Author: User

SQL statement execution sequence

The following figure shows the execution sequence of SQL statements:

(This figure is from the SQL statement execution Sequence Graph)

This picture clearly shows the execution sequence of SQL statements. Today, we have made a question and deepened our understanding of the execution sequence of SQL statements.

There is a table like this:

Question:

Lists the product ids (PRODUCT id: PRODUCT $ id) and quantity of all products contained in more than one order (Order Number: XORDER $ id) in descending order of the PRODUCT id.


The SQL statement is as follows:


Select PRODUCT $ ID, sum (quantity) from LINEITEM group by PRODUCT $ ID having count (PRODUCT $ ID)> 1 order by PRODUCT $ ID desc;



The result is as follows:


Although the where clause is missing in this example, it does not affect the execution process of SQL statements, because the where clause is so common that we have long understood it.

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.