对于教学数据库的三个基本表:      学生 S(S#,SNAME,AGE,SEX)      学习 SC(S#,C#,GRADE)

对于教学数据库的三个基本表:      学生 S(S#,SNAME,AGE,SEX)      学习 SC(S#,C#,GRADE),第1张

怎么出完题目就不见人了,也不来确认??

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='女')

1.create table S

(SNO char(10) primary key,

SNAME varchar(20),

AGE int,

SEX char(2)default '男')

2.SELECT CNO,CNAME FROM C WHERE TEACHER='LI'

3.insert into C values('C01','高等数学','LI')

4.SELECT SNO,SNAME FROM S WHERE AGE>21 AND SEX='男'

5.select CNAME,TEACHER FROM C INNER JOIN SC ON C.CNO=SC.CNO WHERE SC.SNO='S1'

6.SELECT SNAME FROM S

WHERE SEX='男' and SNO in(select SNO from SC inner join

C on SC.CNO=C.CNO WHERE C.TEACHER='LI')

7.select CNO,CNAME FROM C

WHERE CNO in(select CNO from SC inner join

S on SC.SNO=S.SNO WHERE S.SNAME='WANG')

8.SELECT CNO 课程号,SEX 性别,count(*) 总人数,AVG(GRADE) 平均成绩 FROM SC INNER JOIN

S ON SC.SNO=S.SNO group by CNO,SEX

9.select SNAME,SNO from S

where SNO in (select SNO FROM SC group by SNO having count(SNO)>=2)


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/sjk/9924620.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-03
下一篇 2023-05-03

发表评论

登录后才能评论

评论列表(0条)

保存