求教2个高难的sql语句怎么写?

来源:百度知道 编辑:UC知道 时间:2024/06/18 18:54:32
1.有三个表Student(sno,sname),sc(sno,cno,grade),kx(cno,cname)sno是学号,cno和课程编号,grade是成绩,cname是课程名,sname是人名,请问我想查询所有成绩都在80以上的人名,这个sql怎么写?

2.有个表T(a,b,c)要求,按照c降序排列,之后删除第7-13行,这个sql怎么写
是查询一个人所有选修课程的成绩都大于80

1. select a.sname from Student a,sc b where sc.grade>80 and a.sno=b.sno;
2. select top 6( select * from T order by c desc );

select sname from Student a,sc where a.sno=sc.sno group by a.sname,sc.grade having sc.grade>80

delete t where a in(select top 7 from (select top 13 a from t order
by c desc) order by c asc)

记得a应该主键..也就是不可重复的

------------------------------------
刚有个单词错了.你再试下.

1、select * from kx,sc,student where student.sno=sc.sno and sc.cno=kx.cno and cint(grade)>70
2、
<%
...
sql="select * from Student order by sno"
rs.open sql,conn,1,3
dim i
i=0
do while not rs.eof
if i<7 and i>3 then
rs.delete
rs.update
end if
i=i+1
rs.movenext
loop.....

1,
select sname from student where sname not in (select st.sname from Student st,sc,kx where st.sno=sc.sno and sc.cno=kx.cno and sc.grade<80)

2,