table1 UNION ALL table2是否保证输出顺序table1,table2? [英] Does table1 UNION ALL table2 guarantee output order table1, table2?

查看:183
本文介绍了table1 UNION ALL table2是否保证输出顺序table1,table2?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

SELECT a FROM b
UNION ALL 
SELECT a FROM c
UNION ALL 
SELECT a FROM d

UNION ALL是否保证按顺序打印表b,c,d中的记录?也就是说,c之前没有记录,b之前没有记录。这个问题不是针对特定的DBMS的。

Does UNION ALL guarantee to print out records from tables b, c, d in that order? I.e., no records from c before any from b. This question is not for a specific DBMS.

推荐答案

无序,无序保证-适用于每个数据库。

No order by, no order guarantee whatsoever - that's for every database.

对于标准SQL,将ORDER BY应用于所有联合查询的结果。

And for standard SQL, an ORDER BY is applied to the results from all the unioned queries.

这篇关于table1 UNION ALL table2是否保证输出顺序table1,table2?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆