9.Which statement is true regarding the INTERSECT operator?
A.It ignores NULL values.
B.Reversing the order of the intersected tables alters the result.
C.The names of columns in all SELECT statements must be identical.
D.The number of columns and data types must be identical for all SELECT statements in the query.
答案:D
解析:题目问的是INTERSECT操作,这个是获取两个表的交集的
--查询出来两行,只不过另外一行都是null,没有显示出来
A:错误,没有忽略null
B:错误,题目好像说是会反转结果,从结果中没有看到
C:错误,题目说列必须指定,从结果看没有指定也可以,直接使用的*
D: 正确,题目说的是列数和类型必须相同
A.It ignores NULL values.
B.Reversing the order of the intersected tables alters the result.
C.The names of columns in all SELECT statements must be identical.
D.The number of columns and data types must be identical for all SELECT statements in the query.
答案:D
解析:题目问的是INTERSECT操作,这个是获取两个表的交集的
SQL> create table table1(a integer,b integer);
Table created.
SQL> create table table2(a integer,b integer);
Table created.
SQL> insert into table1 values(1,1);
1 row created.
SQL> insert into table1 values(2,2);
1 row created.
SQL> insert into table1 values(null,null);
1 row created.
SQL> insert into table2 values(1,1);
1 row created.
SQL> insert into table2 values(null,null);
1 row created.
SQL> commit;
---intersect操作
SQL> set feedback on
SQL> select * from table1 intersect select * from table2;
A B
---------- ----------
1 1
2 rows selected.
--查询出来两行,只不过另外一行都是null,没有显示出来
A:错误,没有忽略null
B:错误,题目好像说是会反转结果,从结果中没有看到
C:错误,题目说列必须指定,从结果看没有指定也可以,直接使用的*
D: 正确,题目说的是列数和类型必须相同