zoukankan      html  css  js  c++  java
  • sql执行顺序及on和where区别

    sql执行顺序

    from -> on -> join ->此时生成临时表-> where(过滤临时表)->group by (开始可以使用聚合函数以及select字段或别名)-> 聚合函数-> having->select-> distinct-> order by -> 分页(top、limit)

    (1)from 
    (3) join 
    (2) on 
    (4) where 
    (5)group by(开始使用select中的别名,后面的语句中都可以使用)
    (6) avg,sum.... 
    (7)having 
    (8) select 
    (9) distinct 
    (10) order by 

    on 和 where 区别

    多表关联查询时,on是在from和join多张表时生成临时表,然后where根据该临时表再次过滤,即:on为生成临时表前执行,或者说生成的临时表需要on的条件,where为在临时表上再做过滤

  • 相关阅读:
    异或运算
    GitHub使用简介
    归并排序
    快速排序
    字符串匹配
    Runner站立会议06
    Runner站立会议05
    Runner站立会议04
    记计账需求分析
    Runner站立会议03
  • 原文地址:https://www.cnblogs.com/flysand/p/11546844.html
Copyright © 2011-2022 走看看