OCP学习之集合查询
UNION ALL
SELECT 1 num1,
2 char1
FROM dual
UNION ALL
SELECT 3 num2,
3 char2
FROM dual
UNION ALL
SELECT NULL,
NULL
FROM dual
UNION ALL
SELECT NULL,
4
FROM dual;
输出:
NUM1 CHAR1
---------- ----------
1 2
3 3
4
结论:
1)union之后的别名是取决于第一个select的别名
2)别名可以不一致
3)列数量必须一致
4)null不会被忽略
5)不会去重(不解释)