Execution sequence of mysql statements _ MySQL

Source: Internet
Author: User
The execution sequence of mysql statements is bitsCN.com.
In the execution sequence of mysql statements, is the select statement executed first or the group by statement executed first? Is the select statement executed first or the having clause executed first ?? Mysql> select (@ a: = empid) a, heyf_t10. * from heyf_t10; + --- + ------- + -------- + | a | empid | deptid | salary | + --- + ------- + -------- + | 1 | 1 | 10 | 5500 | 2 | 2 | 10 | 4500 | 3 | 3 | 20 | 1900 | 4 | 4 | 20 | 4800 | 5 | 5 | 40 | 6500 | 6 | 6 | 40 | 14500 | 7 | 7 | 40 | 44500 | 8 | 8 | 50 | 6500 | 9 | 9 | 50 | 7500 | + --- + ------- + -------- + 9 rows in set m Ysql> select (@ a: = empid) a, heyf_t10. * from heyf_t10 having @ a = 5; why is the result set Empty when the second query condition of Empty set is having @ a = 5 ?? --------------------------------------------------------------- Mysql> select (@ a: = empid) a, heyf_t10. * from heyf_t10 having empid = 5; + --- + ------- + -------- + | a | empid | deptid | salary | + --- + ------- + -------- + | 5 | 5 | 40 | 6500 | + --- + ------- + -------- + 1 row in set why can I normally return data records when having empid = 5 is used? the summary cannot be in group, having, order by clause uses the user variable bitsCN.com

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.