SQL数据库两题,求速度解答~~

2025-03-04 12:51:54
推荐回答(3个)
回答1:

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.姓名

回答2:

1.SELECT 学号# FROM XS_KC WHER 课程号# IN (101,102)

回答3:

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;