当前位置:网站首页>MySQL execution order

MySQL execution order

2022-07-23 15:24:00 Full stack programmer webmaster

Hello everyone , I meet you again , I'm your friend, Quan Jun .

mysql The order of execution is as follows :

1. from Stage

2. where Stage

3. group by Stage

4. having Stage

5. select Stage

6. order by Stage

7. limit Stage

problem : Why can't aliases be used in where in , But it can be used in order by in ?

according to mysql Execution order of , You can know , The above code executes from score , I'll do it again where , Finally implemented select . Aliases are generated in the fifth query phase , With the alias , Can only be used in later execution stages , in other words , Aliases can only be used for queries after phase 5 . therefore where total >= 200 Execution time , Alias has not been generated total, So compilation error .

Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/125978.html Link to the original text :https://javaforall.cn

原网站

版权声明
本文为[Full stack programmer webmaster]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/204/202207231018568269.html