select Sno from SPJ where JNO = ‘J1’
select SNo from SPJ where Jno = ‘J1’ and PNO = ‘P1’
select SNO from SPJ where PNO IN (select PNO from P where COLOR=‘红‘)
select * from SPJ where SNO IN(select SNO from S where CITY=‘天津‘) and PNO IN(select PNO from P where COLOR=‘红‘)
select * from SPJ where exists(select * from SPJ where SNO=‘S1‘)
select SNAME,CITY from S
select PNAME,COLOR,WEIGHT from P
select JNO from SPJ where SNO = ‘S1‘
select P.PNAME AS NAME,count(SPJ.JNO) AS NUM from SPJ,P where SPJ.JNO=‘J2‘ and SPJ.PNO = P.PNO group by P.PNAME
select distinct PNO from SPJ where SNO IN(select SNO from S where CITY=‘上海‘)
select distinct JNO from SPJ where SNO =(select SNO from S where CITY=‘上海‘)
select distinct JNO from SPJ where SNO not in(select SNO from S where CITY=‘天津‘)
update P set COLOR = ‘蓝‘ where COLOR = ‘红’
update SPJ set SNO=‘S3‘ where SNO=‘S5‘ AND PNO=‘P6‘
delete from SPJ where SNO=‘S2‘ delete from S where SNO=‘S2‘
insert into SPJ(SNO,JNO,PNO,QTY) values(‘S2‘,‘J6‘,‘P4‘,200)
原文:https://www.cnblogs.com/djlobster/p/13099828.html