惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

美团技术团队
D
DataBreaches.Net
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
D
Docker
N
Netflix TechBlog - Medium
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
C
Check Point Blog
腾讯CDC
Stack Overflow Blog
Stack Overflow Blog
V
Visual Studio Blog
IT之家
IT之家
月光博客
月光博客
U
Unit 42
K
Kaspersky official blog
T
Threatpost
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
GbyAI
GbyAI
P
Proofpoint News Feed
Last Week in AI
Last Week in AI
云风的 BLOG
云风的 BLOG
酷 壳 – CoolShell
酷 壳 – CoolShell
I
InfoQ
Engineering at Meta
Engineering at Meta
Recorded Future
Recorded Future
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
S
Security @ Cisco Blogs
MyScale Blog
MyScale Blog
大猫的无限游戏
大猫的无限游戏
Security Archives - TechRepublic
Security Archives - TechRepublic
Webroot Blog
Webroot Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Hacker News - Newest:
Hacker News - Newest: "LLM"
S
Schneier on Security
S
Secure Thoughts
The Register - Security
The Register - Security
B
Blog RSS Feed
The Last Watchdog
The Last Watchdog
P
Palo Alto Networks Blog
爱范儿
爱范儿
B
Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
N
News and Events Feed by Topic
阮一峰的网络日志
阮一峰的网络日志
L
LINUX DO - 热门话题
C
Cisco Blogs
Spread Privacy
Spread Privacy
F
Full Disclosure
博客园 - 聂微东
T
The Blog of Author Tim Ferriss

博客园 - zhuibobo

SQL将多行连接显示 基于Web用户控件的Portal flex-流程设计器 WebHL(模仿QQ写的Ajax程序)^_^ JavaScript笔记(可以被钉住的层) JavaScript笔记(带动画效果弹出的层) 新手的入门-设计模式二[一块开工厂把~] 新手的入门-设计模式一[玩玩策略吗?] 读取sql2000,sql2005中的表结构[转贴] 代码生成器(Asp.net(C#)) 十五天的假期-11 十五天的假期-9 十五天的假期-10 十五天的假期-8 十五天的假期-7 十五天的假期-5 十五天的假期-6 十五天的假期-4 十五天的假期-3
SQL逻辑查询处理中的各个阶段
zhuibobo · 2010-10-14 · via 博客园 - zhuibobo

(8) select (9) distinct (11) <top> <select_list>

(1) from <left_table>

(3) <join_type> join <right_table>

(2) on <join_condition>

(4) where <where_condition>

(5) group by (group_by_list)

(6) with (cube_rollup) 

(7) having <having_condition>

(10) order by <order_by_list> 

(1) 执行笛卡尔乘积(交叉连接)

将要查询的表进行交叉连接,形成一个表V1 

(2)应用on筛选

对V1进行首次的筛选形成V2 

(3)添加外部行(left right full join)

为进行过on筛选的V2添加外部行,视left right full join 的情况而定.inner join忽略该步骤.如果还有其他连接表,重复(1)-(3)直到形成V3,由于该步骤在on筛选之后,所以被on筛选去掉的记录可能被重新添加回V3

(4)应用where筛选 

为V3进行筛选形成V4. 

(5)分组

 为V4进行分组形成V5

(6)应用cube或者roolup

执行cube或者roolup形成V6

(7)应用having筛选器

应用分组筛选器having形成v7 

(8)处理select列表

处理select列表,列别名的定义只能在以后的步骤中使用.形成V8

(9)应用distinct子句 

应用distinct形成v9 

(10)应用order by 子句

应用order返回游标V10

应用了distinct的查询不可以应用select_list外的排序,未应用distinct的查询则可以应用select_list外的排序项,因为这一步不返回表(而是返回游标),使用了order by 子句的查询不能用作表表达式,

如下将产生错误

select * from (select * from xxx order by orderid) as a 

(11)应用Top选项 

应用top形成V11,返回最终结果.