你可能感兴趣的试题
S、J和SJP S、P和SJP P、J和SJP S、J、P和SJP
FOREIGN KEY PRIMARY KEY FOREIGN KEY(Sno) REFERENCES S FOREIGN KEY(Pno) REFERENCES P
SELECT DISTINCTSname SELECT DISTm CTSname
FROMS FROMS
WHERE EXISTS WHERE 0<
(SELECT* (SELECTCOUNT(*)
FROM SPJ FROM SPJ
WHERE S.Sno=SPJ.SnO WHERE S.Sno;SPJ.Sno
AND SPJ.Pno;,P3, AND SPJ.Pno=’P3’) SELECT Shame SELECT Sname
FROMS FROMS,SPJ
WHERE EXISTS WHERES.Sno=SPJ.Sno
(SELECT* ANDSPJ.Pno=’P3’)
FROM SPJ GROUP BYSname
WHERE S. Sno=SPJ. Sno
AND SPJ. Pno=’P3’)
PRIMARY KEY (Sno) REFERENCE S (Sno),FOREIGN KEY (Pno) REFERENCES P (Pno)
FOREIGN KEY (Sno) REFERENCE S (Sno),PRIMARY KEY (Pno) REFERENCES P (Pno)
FOREIGN KEY (Sno) REFERENCE S (Sno),FOREIGN KEY (Pno) REFERENCES P (Pno)
PRIMARY KEY (Sno) REFERENCE S (Sno),PRIMARY KEY (Pno) REFERENCES P (Pno)
FOREIGN KEY PRIMARY KEY FOREIGN KEY(Sno) REFERENCES S FOREIGN KEY(Pno) REFERENCES P
SELECT DISTINCT Sname
FROM S
WHERERE 0 < (SELECT COUNT( * )FROM SPJ WHERE S. Sno = SPJ. Sno
AND SPJ. Pno = ’P3’) SELECT DISTINCT Sname
FROM S
WHERE EXISTS(SELECT * FROM SPJ WHERE S. Sno=SPJ. Sno
AND SPJ. Pno= ’P3’) SELECT Sname
FROM S
WHERE EXISTS( SELECT * FROM SPJ WHERE S. Sno = SPJ. Sno AND SPJ. Pno = ’P3’) SELECT Sname
FROM S, SPJ
WHERE S. Sno = SPJ. Sno AND SPJ. Pno = ’P3’
GROUP BY Sname
S、J和SJP S、P和SJP P、J和SJP S、J、P和SJP
∏ sname (S) D∞ σ Pno = ’P3’ (SPJ) ∏ sname (SD ∞ σ Pno = ’P3’ (SPJ) ) ∏sname (S) -∏sname (σPno ≠ ’P3’ (S∞ (SPJ) ∏sname (S) -∏sname ((S∞σPno ≠ ’P3’ (SPJ)
πSNO(πSNO,PNO(σJNO=’J1’(S))×πPNO(σCOLOR=’红’(P))) πSNO(πSNO,PNO(σJNO=’J1’(S))πPNO(σCOLOR=’红’(SPJ))) πSNO(πSNO,PNO(σJNO=’J1’(SPJ))πPNO(σCOLOR=’红’(P))) πSNO(πSNO,PNO(σJNO=’J1’(SPJ))×πPNO(σCOLOR=’红’(P)))
S、J和SJP S、P和SJP P、J和SJP S、J、P和SJP
SELECT DISTINCT Sname SELECT DISTmCT Sname
FROMS FROMS
WHERE EXISTS WHERE 0<
(SELECT * (SEIECT COUNT (*)
FROM SPJ FROM SPJ
WHERE S.Sno=SPJ.SnO WHERE S.Sno=SPJ.Sno
AND SPJ.Pno= ’P3’) AND SPJ.Pno= ’P3’) SELECT Sname SELECT Sname
FROMS FROMS, SPJ
WHERE EXISTS WHERES.Sno=SPJ.Sno
(SELECT * AND SPJ.Pno= ’P3’)
FROM SPJ GROUP BYSname
WHERE S.Sno=SPJ.Sno
AND SPJ.Pno= ’P3’)
SELECT DISTINCT Sname
FROMS
WHERE EXISTS
(SELECT*
FROM SPJ
WHERE S. Sno=SPJ. SnO
AND SPJ.Pno=’P3’) SELECT DISTmCT Sname
FROMS
WHERE 0<
(SEIECT COUNT (*)
FROM SPJ
WHERES.Sno=SPJ.Sno
AND SPJ.Pno=’P3’) SELECT Sname
FROMS
WHERE EXISTS
(SELECT*
FROM SPJ
WHERES.Sno=SPJ.Sno
ANDSPJ.Pno=’P3’) SELECT Sname
FROMS,SPJ
WHERES.Sno=SPJ.Sno
ANDSPJ.Pno=’P3’)
GROUP BYSname
πSNO(πSNO,PNO(σJNO=’J1’(S))×πPNO(σCOLOR=’红’(P))) πSNO(πSNO,PNO(σJNO=’J1’(S))πPNO(σCOLOR=’红’(SPJ))) πSNO(πSNO,PNO(σJNO=’J1’(SPJ))πPNO(σCOLOR=’红’(P))) πSNO(πSNO,PNO(σJNO=’J1’(SPJ))×πPNO(σCOLOR=’红’(P)))
SELECTSname FROM S WHERE EXIST5 (SELECT * FROM SPJ WHERE S.Sno=SPJ.Sno AND SPJ.Pno=’P3’) SELECT Sname FROM S,SPJ WHERE S.Sno=SPJ.Sno AND SPJ.Pno=’P3’) CROUP BY Sname SELECT DISTINCT Sname FROM S WHERE EXISTS (SELECT * FROM SPJ WHERE S.Sno=SPJ.Sno AND SPJ.Pno=’P3’) SELECT DISTINCT Sname FROM S WHERERE 0< (SELECTCOUNT(,) FROM SPJ WHERE S.Sno=SPJ.Sno AND SPJ.Pnn=’P3’)
Isnarne(S)Dσ O Pno=’P3’(SPJ) Hsname(SD∞σ(yPno=’P3’(SPJ)) Hsname(S)-Hsname(σPno≠’P3’(Sσσ(SPJ) Hsname(S)-nsname((Soorr Pno≠’P3’(SPJ)
пsname (S) D∞ σPno=’P3’(SPJ) пsname (SD∞ σPno=’P3’(SPJ) ) пsname(S)-пsname (σPno≠’P3’ (S∞(SPJ) пsname(S)-пsname ((S∞σPno≠’P3’,(SPJ)
SELECT * FROM S WHERE CITY=′北京′ SELECT SNO, SNAME FROM S WHERE CITY=′北京′ SELECT * FROM S, P WHERE CITY=′北京′AND SNO=SJ SNO AND SJ PNO= PNO SELECT * FROM P,S, SJP WHERE CITY=′北京′AND SNO=SJ SNO AND SJ PNO= PNO
Πsname(S)-Πsname(σPno≠’P3’(S∞(SPJ) Πsname(S)—nsname((S∞σPno≠’P3’(SPJ) Πsname(S)D∞σPno=’P3’(SPJ) Πsname(SD∞σPno=’P3’(SPJ))