一道001试题的疑问

[复制链接]
查看11 | 回复1 | 2002-1-18 11:09:00 | 显示全部楼层 |阅读模式
run this sql statement;
select id_number,description,price
from inventory
where manufacture_id in
(select manufacture_id
from inventory
where price>8.00
or quantity >1000);
which values will be displayed?
答案:
C.The id number,description,and price of items in inventory that are
priced greater than 8.00 or that have a quantity value granter than
1000 and have a manufacture id value.


D.The id number,description,and price of items in inventory that were
manufactured by a manufacture whth items in invertory that are priced
greater than 8.00 or with items in invertorythat are priced greater
than 8.00 or with items in inventory that have a quantity value granter
than 1000.
我选的是C,可正确答案是D,不明白是为什么?
回复

使用道具 举报

千问 | 2002-1-18 11:09:00 | 显示全部楼层
It should be D.
1 select id_number,description,price
2 from inventory
3 where manufacture_id in
4(select manufacture_id
5from inventory
6where price>8.00
7or quantity >1000);
Line 4 - 7 are sub-query, which select out the list of
manufacture_id,
where price>8.00
or quantity >1000
and Line 1 - 3 query table inventory for rows, whose manufacture_id is
in the list of sub-query.
So even this row's price and quantity is not ture of the condition but its manufacture_id in the sub-query list. This row will return.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行