关泉数据库 习题
求供应工程J零件的供应商号SNO (S、P、J、SPJ) SQL) SELECT SNO FROM SPJ WHERE J=‘J1
1 求供应工程J1 零件的供应商号SNO . ( S、P、J、SPJ ) ■ SQL SELECT SNO FROM SPJ WHERE J=‘J1’
2求供应工程J零件P1的供应商号SNO;(S、P、JSPJ) SQL SELECT SNO FROM SPJ WHERE J=6J1’ANDP=“P1
2 求供应工程J1 零件 P1 的供应商号SNO ; ( S、P、J、SPJ ) ■ SQL SELECT SNO FROM SPJ WHERE J=‘J1’ AND P=‘P1’
3求供应工程J红色零件的供应商号SNO;(S、P、J、SPJ) SQL SELECT SNO FROM SPJ. P WHERE J=J1 AND PPNO=SPJ PNO AND COLOR=红 SELECT SNO FROM SPJ WHERE J=5J1’ AND PNO N SELECT PNO FROM WHERE COLOR=“红
3 求供应工程J1 红色零件的供应商号SNO ; ( S、P、J、SPJ ) ■ SQL SELECT SNO FROM SPJ , P WHERE J=‘J1’ AND P.PNO=SPJ.PNO AND COLOR=‘红’ SELECT SNO FROM SPJ WHERE J=‘J1’ AND PNO IN (SELECT PNO FROM p WHERE COLOR=‘红’
4求没有使用天津供应商生产的红色零件的工程号JNO SQL SELECT NO FROM WHERE JNO NOT IN SELECT JNO FROM SPJ WHERE PNO N C SELECT PNO FROM WHERE COLOR=“红 AND SNO IN C SELECT SNO FROM S WHERE CITY=天津
4 求没有使用天津供应商生产的红色零件的工程号JNO . ■ SQL SELECT JNO FROM J WHERE JNO NOT IN (SELECT JNO FROM SPJ WHERE PNO IN ( SELECT PNO FROM P WHERE COLOR=‘红’ ) AND SNO IN ( SELECT SNO FROM S WHERE CITY=‘天津’ ) )
5求至少用了S供应商所供应的全部零件的工程号JNO; SQL) XP≡_(3x(1P)) SELECT DISTINCT JNO FROM SPJ SPJZ WHERE NOT EXISTS SELECT X FROM SPJ SPJX WHERE SNO=SI AND NOT EXIST C SELECT FROM SPJ SPJY WHERE SPX PNO=SPJYPNO AND SPJYJNO-SPJZJNO
5 求至少用了S1供应商所供应的全部零件的工程号JNO ; ■ SQL SELECT DISTINCT JNO FROM SPJ SPJZ WHERE NOT EXISTS (SELECT * FROM SPJ SPJX WHERE SNO=‘S1’ AND NOT EXISTS ( SELECT * FROM SPJ SPJY WHERE SPJX.PNO=SPJY.PNO AND SPJY.JNO=SPJZ.JNO ) ) ∀xP ≡ ┓(ヨx(┓P ) )
求供应工程J零件的供应商号SNO S、P、J、SPJ) (关系代数 (OJNO-JI(SPD)) ALPHA GET W(SPJSNO): SPJJNO=J1 QBE SPJ SNO PNO JNO QTY PSI JI
1 求供应工程J1 零件的供应商号SNO . ( S、P、J、SPJ ) πSNO(σJNO=‘J1’(SPJ)) GET W ( SPJ.SNO ) : SPJ.JNO=‘ J1 ’ ■ 关系代数 ■ ALPHA ■ QBE SPJ SNO PNO JNO QTY P. S1 J1
2求供应工程J零件P1的供应商号SNO;(S、P、JSPJ) (关系代数 πsO(ONon∧PNo=sPr(SPJ) ( ALPHA GETW( SPJSNO): SPJJNO=J1’∧ SPJPNO=‘P1 QBE SPJ SNO PNO JNO QTY PSI P J1
2 求供应工程J1 零件 P1 的供应商号SNO ; ( S、P、J、SPJ ) GET W ( SPJ.SNO ) : SPJ.JNO=‘ J1 ’ ∧ SPJ.PNO= ‘ P1 ’ ■ 关系代数 ■ ALPHA ■ QBE SPJ SNO PNO JNO QTY P. S1 P1 J1 πSNO(σJNO=‘J1’ ∧ PNO=‘SPJ’ (SPJ))
3求供应工程J红色零件的供应商号SNO;(S、P、J、SPJ) (关系代数 7sO(0o0O0红小No=n(P凶SPJ) ALPHA RANGE P PX GETW( SPJPNO):彐PX( PX. PNO= SPJPNO∧ SPJJNO=‘J1’∧ PX. COLOR=RED”)
3 求供应工程J1 红色零件的供应商号SNO ; ( S、P、J、SPJ ) ■ 关系代数 ■ ALPHA πSNO(σCOLOR=‘红色’ ∧ JNO=‘J1’ (P SPJ)) RANGE P PX GET W ( SPJ.PNO ) : ∃ PX ( PX.PNO = SPJ.PNO ∧ SPJ.JNO = ‘ J1 ’ ∧ PX.COLOR=‘ RED ’)
3求供应工程J红色零件的供应商号SNO;(S、P、J、SPJ) QBE SPJ SNO PNO JNO QTY P S1 P1 J1 P PNO PNAME COLOR WEIGHT 红
3 求供应工程J1 红色零件的供应商号SNO ; ( S、P、J、SPJ ) ■ QBE SPJ SNO PNO JNO QTY P. S1 P1 J1 P PNO PNAME COLOR WEIGHT P1 红