SQL Execution sequence [reprinted]

Source: Internet
Author: User

The complete execution sequence of the SQL SELECT statement:

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. Use order by to sort the result set.

What's worse, it's not mentioned.
The keyword "select. I discussed it with my classmates and thought it should be executed at the end, because I thought it was necessary to wait until the execution of all the conditions was complete and then retrieve the data -- but I didn't find any definite evidence.
Data. Today, I discussed this with another female. Indeed, the female is very careful. She gave other comments on "select. So I also began to shake it, Because orderby is to judge
Does the SELECT statement contain any field after orderby. At this time, the Chinese search can only find the above content, so you have to use the English search, the Search Keyword: SQL Execute

  1. From clause
  2. Where clause
  3. Group by clause
  4. Having clause
  5. Select clause
  6. Order by clause

I think this is a reasonable answer.

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.