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

2024-11-06 11:02:04
推荐回答(3个)
回答(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='女');

回答(2):

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='女');
楼主是在考试中?问题太多了呀

回答(3):

1.select sname,sno from S where age<22;
你给的信息不详细啊