用SQL语句查出分数最高的前20位学生

时间:2023-01-08 07:57:42

数据库中有学院表和成绩表:

学院表T_SCHOOL,结构如下:

学院ID:school_id;

学院名称:school_name;

成绩表T_SCORE,结构如下:

学号:id;

姓名:name;

分数:score;

学院ID:school_id。

select top 20 T_SCORE.name from T_SCORE,T_SCHOOL

where T_SCORE.school_id=T_SCHOOL.school_id and T_SCHOOL.name="计算机系”

order by T_SCORE.score desc