首页 > 试题广场 >

请用sql语句查询出学院名称为"计算机系"的分数最高的前20

[问答题]
数据库中有学院表和成绩表
学院表t_school结构如下:
学院ID:school_id,学院名称:school_name
成绩表t_score结构如下:
学号:id.姓名:name,分数:score,学院ID:school_id
请用sql语句查询出学院名称为"计算机系"的分数最高的前20位的学生姓名
select name
from t_score where school_id in
(select school_id from t_school where school_name = '计算机系')
order by score DESC limit 20

发表于 2016-09-01 17:40:58 回复(1)
select score.name from t_school school, t_score score where school.school_id = score.school_id and school.school_name="计算机系" order by score.score desc limit 20
发表于 2016-08-30 14:54:24 回复(0)
为什么都直接从成绩表中查出前20的学生呢???难道不应该选出总成绩前20的吗???
发表于 2019-03-12 13:57:02 回复(0)
select top 20 sname from t_score,t_school 
where t_school.school_id=t_school.school_id and school_name='计算机系' 
order by score desc;
发表于 2018-11-02 15:52:47 回复(0)
Oracle,求指正
select x.name from (select t.name from t_score t
inner join t_school a on t.school_id=a.school_id and a.school_name='计算机系'
order by t.score) x
where rownum<=20;
发表于 2017-08-19 18:34:47 回复(0)
select score.name from t_school school, t_score score where school.school_id = score.school_id and school.school_name="计算机系" order by score.score desc limit 20
发表于 2016-09-12 10:26:21 回复(0)
没有oracle下的写法吗
发表于 2016-09-11 10:14:15 回复(0)
select name from (select b.school_id,b.school_name,a.id,a.name,a.score from t_score a inner join t_school b on a.school_id=b.school_id order by score desc) t where t.scool_name='计算机系' limit 20;
发表于 2016-09-03 20:13:15 回复(0)
select score.name from t_school school,t_score score where school.school_id=score.school_id and school.school_name="计算机系" order by score.score desc limit 20

发表于 2016-08-31 19:32:16 回复(0)
select score.name from t_school school, t_score score where school.school_id = score.school_id and school.school_name="计算机系" order by score.score desc limit 20
发表于 2015-10-20 10:02:03 回复(1)