1.Mysql执行顺序,即在执行时sql按照下面的顺序进行执行:

from
on
join
where
group by
having
select
distinct
union
order by

2.Mysql语法顺序,即当sql中存在下面的关键字时,它们要保持这样的顺序:

select[distinct]  
from  
join(如left joinon  
where  
group by  
having  
union  
order by  
limit  

groupby:groupby要和聚合函数一起使用

union:完全是对select的结果进行合并(默认去掉重复的记录)(想保留重复记录使用union all)

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-07-10
  • 2022-01-19
  • 2022-02-09
  • 2022-03-06
  • 2022-12-23
猜你喜欢
  • 2021-12-04
  • 2021-05-30
  • 2022-12-23
  • 2022-12-23
  • 2021-08-11
相关资源
相似解决方案