SQL format execution sequence of oracle data structure and sequence number of SQL query processing, oraclesql

Source: Internet
Author: User

SQL format execution sequence of oracle data structure and sequence number of SQL query processing, oraclesql

I. execution sequence of SQL format

FROM-> WHERE-> group by-> HAVING-> SELECT-> ORDER

1. The from clause assembles data from different data sources;

2. The where clause filters record rows based on specified conditions;

3. The group by clause divides data into multiple groups;

4. Use Aggregate functions for computation;

5. Use the having clause to filter groups;

6. Calculate all expressions;

7. select fields;

8. Use order by to sort the result set.

Unlike other programming languages, SQL is most characteristic of code processing. In most database languages, codes are processed in the encoding order. However, in an SQL statement, the first clause to be processed is FROM, rather than the first SELECT statement to appear. Sequence Number of the SQL Query Process:

1 (8) SELECT (9) DISTINCT (11)

2 (1) FROM

3 (3) JOIN

4 (2) ON

5 (4) WHERE

6 (5) GROUP

7 (6) WITH {CUBE | ROLLUP}

8 (7) HAVING

9 (10) ORDER

Each of the preceding steps generates a virtual table, which is used as the input for the next step. These virtual tables are unavailable to callers (client applications or external queries. Only the table generated in the last step will be sent to the caller. If a clause is not specified in the query, the corresponding steps are skipped.

Related Article

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.