本文共 2436 字,大约阅读时间需要 8 分钟。
select SNAME, CITY from S;
select PNAME, COLOR, WEIGHT from P;
select JNO from SPJ where SNO = 'S1';
select Pname, QTY from SPJ, P where P.PNO = SPJ.PNO and SPJ.JNO = 'J2';
select PNO from SPJ, S where S.SNO = SPJ.SNO and CITY = '上海';
select JNAME from SPJ, S, J where S.SNO = SPJ.SNO and S.CITY = '上海' and J.JNO = SPJ.JNO;
select JNO from SPJ where JNO not in (select distinct JNO from SPJ, S where S.SNO = SPJ.SNO and S.CITY = '天津');
update P set COLOR = '蓝' where COLOR = '红';
update SPJ set SNO = 'S3' where SNO = 'S5' and JNO = 'J4' and PNO = 'P6';
delete from S where SNO = 'S2'; delete from SPJ where SNO = 'S2';
insert into SPJ values('S2', 'J6', 'P4', 200);create view J1_view as select SNO, PNO, QTY from SPJ where JNO = 'J1';
select PNO, sum(QTY) from J1_view group by PNO;
select PNO, QTY from J1_view where SNO = 'S1';
转载地址:http://dknb.baihongyu.com/