QUESTION NO: 27
Which statement is true regarding the UNION operator?
A. The number of columns selected in all SELECT statements need to be the same
B. Names of all columns must be identical across all SELECT statements
C. By default, the output is not sorted
D. NULL values are not ignored during duplicate checking
Answer: D
答案解析:
参考:152:http://blog.csdn.net/rlhua/article/details/12884213
Explanation:
The columns in the queries that make up a compound query can have different names, but the
output result set will use the names of the columns in the first query.
A compound query will by default return rows sorted across all the columns, from left to right. The
only exception is UNION ALL, where the rows will not be sorted. The only place where an ORDER
BY clause is permitted is at the end of the compound query.
Oracle Server and Set Operators
• Duplicate rows are automatically eliminated except in UNION ALL.
• Column names from the first query appear in the result.
• The output is sorted in ascending order by default except in UNION ALL.
本文详细解释了SQL中UNION操作符的特点与使用方法。强调了在复合查询中,尽管列名可以不同,但结果集将采用第一条查询语句中的列名;默认情况下,输出结果会按升序排序,且重复行会被自动去除(除了使用UNION ALL的情况)。此外,还指出了NULL值在检查重复项时不会被忽略。
7052

被折叠的 条评论
为什么被折叠?



