题目1:
(以下的null 代表真的null,我写在这里只是为了让大家看清楚)
根据如下表的查询结果,那么以下语句的结果是
SQL> select * from usertable;
USERID USERNAME
----------- ----------------
1 user1
2 null
3 user3
4 null
5 user5
6 user6
SQL> select * from usergrade;
USERID USERNAME GRADE
---------- ---------------- ----------
1 user1 90
2 null 80
7 user7 80
8 user8 90
执行语句:
语句一: select count(*) from usergrade where username not in (select username from usertable);
语句二: select count(*) from usergrade g where not exists (select null from usertable t where t.userid=g.userid and t.username=g.username);
以上语句一的执行结果是: ( ) , 以上语句二的执行结果是: ( )
A: 0 B: 1 C: 2 D: 3 E: 4 F: 5 G: NULL
题目2:
(以下的null 代表真的null,我写在这里只是为了让大家看清楚)
在以下的表的显示结果中,以下语句的执行结果是
SQL> select * from usertable;
USERID USERNAME
----------- ----------------
1 user1
2 user2
3 user3
4 user4
5 user5
SQL> select * from usergrade;
USERNAME GRADE
---------------- ----------
user9 90
user8 80
user7 80
user2 90
user1 100
user1 80
执行语句
语句一: Select count(*) from usertable t1 where username in (select username from usergrade t2 where rownum <=1);
语句二: Select count(*) from usertable t1 where exists (select 'x' from usergrade t2 where t1.username=t2.username and rownum <=1);
以上语句一的执行结果是: ( ) , 以上语句二的执行结果是: ( )
A: 0 B: 1 C: 2 D: 3
阅读(1461) | 评论(0) | 转发(0) |