5,889
社区成员
发帖
与我相关
我的任务
分享
-- 第一题
select s.sname from
(select sid,scr from sc where tcl = 'a') t1,
(select sid,scr from sc where tcl = 'b') t2, s where t1.sid = t2.sid and t1.scr > t2.scr
and s.sid = t1.sid;
-- 第二题
select s.sname from
(select sid from sc,t where sc.tcl = t.tcl and t.tname <> 'li'
minus
select sid from sc,t where sc.tcl = t.tcl and t.tname = 'li') t,s where s.sid= t.sid;
问题一。参考某楼
select
s.sname as '姓名',sc1.scr as 'A成绩',sc2.scr as 'B成绩'
from
s,sc sc1,sc sc2
where s.sid=sc1.sid
and s.sid=sc2.sid
and sc1.tcl='A'
and sc2.tcl='B'
and sc1.scr>sc2.scr