sql脚本语句中的关键字

    sql语句每次执行的过程中也是经过了一次编译,然后运行的过程,每一个关键词执行的过程中都是产生了一张临时表,然后不断从关键词中获取传入的参数,对当前的临时表格数据进行过滤的一个过程,然后得到我们的最终数据结果集,所以在sql脚本优化的过程中必须知道sql脚本运行的机制。

    sql脚本中的常见关键词;

       select,from ,as ,distinct,count,where,inner,left,right,join,exist,in,not,group by,having, when,then,sum,  order by,alter,drop,top,on with

       update set; insert  into values;delete  from;

       case when  condition then else end 

        

      select  distinct  count(*)  from (

          select  * from table  where  condition   

      ) as t1  left join  t2 on  t1.name=t2.name  group by  t1.name  having  condition

原文地址:https://www.cnblogs.com/snowhumen/p/2573624.html