问题 单项选择题

假设供应商S和供应情况SPJ的关系模式分别为S(Sno,Sname,Status,City)和SPJ (Sno,Pno,Jno,Qty)。SQL语句 (25) 不能正确地查询出“零件号Pno等于’P3’的供应商名Sname",而 (26) 能正确查询的关系代数表达式。

A.SELECT DISTINCT Sname
FROM S
WHERERE 0 < (SELECT COUNT( * )FROM SPJ WHERE S. Sno = SPJ. Sno
AND SPJ. Pno = ’P3’)

B.SELECT DISTINCT Sname
FROM S
WHERE EXISTS(SELECT * FROM SPJ WHERE S. Sno=SPJ. Sno
AND SPJ. Pno= ’P3’)

C.SELECT Sname
FROM S
WHERE EXISTS( SELECT * FROM SPJ WHERE S. Sno = SPJ. Sno AND SPJ. Pno = ’P3’)

D.SELECT Sname
FROM S, SPJ
WHERE S. Sno = SPJ. Sno AND SPJ. Pno = ’P3’
GROUP BY Sname

答案

参考答案:C

解答题
简答题