1,select s,sname from S where age<22 and sex='女'
2,select count(*) from SC
3,select sname,age where sex='男' and age>(select max(age) from S where sex='女')
4,insert into S values('S9','WU',18)
5,delete from SC where grade is null
6,update SC set grade=grade*1.05 where c='C4' and grade<=75
update SC set grade=grade*1.04 where c='C4' and grade>75
7,select sname from S where sex='女' and sno in(
select sno from SC where c in(
select c from C where teacher='LIU老师'))
8,select c,cname from C where c in(
select c from SC SC1 where exists(
select * from SC SC2 where SC2.c=SC1.c and SC2.s in(
select S.s from S)))
9,select s,sname from S where sex='男' and age>23
10,select s from S where exists(
select * from SC where SC.s=S.s and c in(
select c from C where teacher='LIU老师'))
11,select SC1.s
from (select SC.s,count(*) countnum from SC group by SC.s) SC1
where SC1.countnum>=2
12,select c,avg(grade) from SC
where c in(select C.c from C where teacher='LIU老师')
group by SC.c
13,select sname,age from S where sname like 'WANG%'
14,insert into STUDENT
select S.s,S.sname,S.sex from S where not exists(
select * from SC where S.s=SC.s and grade<80)
15,select s,c from SC where grade is null
16,select S1.sname,S1.age from S S1 where S1.sex='男' and S1.age>(
select avg(age) from S S2 where S2.sex='女')
--1SELECT C#,CNAME FROM C WHERE C# IN(
SELECT C# FROM SC GROUP BY C# HAVING COUNT(S#)=(SELECT MAX(S#) FROM S)
)
--2
update SC set SC.GRADE=SC.GRADE*1.05 from S where SC.GRADE<(select avg(SC.GRADE) from SC) and S.SEX='0'
--3
SELECT S#,SNAME FROM S WHERE S# IN(
select S# from SC group by S# having count(C#)>=3
)
--4
update SC set SC.GRADE=60 from C where C.CNAME='数学' and C.C#=SC.C#
--5
select C#,CNAME FROM C WHERE C# not IN(
select SC.C# from SC left join S on S.S#=SC.S# where S.SNAME='张三'
)
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)