●假设供应商S和供应情况SPJ的关系模式分别为S(Sno,Sname,Status,City)和SPJ(Sno,Pno,Jno,Qty)。SQL语句 (19) 不能正确地查询出"零件号Pno等于'P3'的供应商名Sname",而 (20) 能正确查询的关系代数表达式。
(19) A.SELECT DISTINCT Sname
FROMS
WHERE EXISTS
(SELECT*
FROM SPJ
WHERE S.Sno=SPJ.SnO
AND SPJ.Pno=′P3′
B.SELECT DISTmCT Sname
FROMS
WHERE 0<
(SEIECT COUNT(*)
FROM SPJ
WHERE S.Sno=SPJ.Sno
AND SPJ.Pno=′P3′)
C.SELECT Sname
FROMS
WHERE EXISTS
(SELECT*
FROM SPJ
WHERE S.Sno=SPJ.Sno
AND SPJ.Pno=′P3′)
D.SELECT Sname
FROMS,SPJ
WHERES.Sno=SPJ.Sno
AND SPJ.Pno=′P3′)
GROUP BYSname
(20) A.Πsname(S)Dσ 0 Pno=′P3′(SPJ)
B.Πsname(SD∞σ Pno=′P3′(SPJ))
C.Πsname(S)-Πsname(σ Pno≠′P3′(Sσσ(SPJ)
D.Πsname(S)-Πsname((S∞σ Pno≠′P3′(SPJ)