select a.学号 from xs-kc a
where a.课程号=101
and exists (select 0 from xs-kc b
where a.学号=b.学号
and b.课程号=102
and a.成绩>b.成绩);
select a.学号,b.姓名,count(0),avg(a.成绩)
from xs-kc a,xs b
where a.学号=b.学号
group by a.学号,b.姓名
1.SELECT 学号# FROM XS_KC WHER 课程号# IN (101,102)
select * from student a where
(select score from score b where b.sid=a.id and b.cid='001')>
(select score from score c where c.sid=a.id and c.cid='002'
select a.id,name,count(b.cid),sum(score)
from student a,score b
where a.id=b.sid
group by a.id,name;