SQL语句-执行顺序

在平时练习中,常出现类似字段别名引用等逻辑性问题,那下面来了解SQL执行顺序,规避常见逻辑不清等问题:

1、常见SQL书写顺序:

select(1)distinct(2)
from(3)
join(4)
on(5)
where(6)
group by(7)
with(8)
having(9)
order by(10)
limit(11)

2、SQL执行顺序:

from(1)
on(2)
join(3)
where(4)
group by(5)
with(6)
having(7)
select(8)distinct(9)
order by(10)
limit(11)

3、SQL执行时注意事项:

并非所有的数据库对 SQL 语句使用相同的解析方式。每个数据库对SQL语句的执行方式都存在细微差别。

4、补充资料链接

https://sqlite.org/syntax/join-clause.html
在这里插入图片描述
https://www.cnblogs.com/huminxxl/p/3149097.html

猜你喜欢

转载自blog.csdn.net/weixin_44167164/article/details/86592007