首页 > 代码库 > select from where group by having order by执行规则

select from where group by having order by执行规则

执行顺序依次是from — where — group by — having — select — order by

其中select 和 from 是必选项

from 后面的表自右向左解析,所以数据量小的表放在最右边进行关联(用小表关联大表)

where 条件后面的条件自上向下解析(把能筛选出小量数据的条件放在最左边)

 

select from where group by having order by执行规则