–1.学生表 Student(s_id,s_name,s_birth,s_sex) --学生编号,学生姓名, 出生年月,学生性别 –2.课程表 Course(c_id,c_name,t_id) – --课程编号, 课程名称, 教师编号 –3.教师表 Teacher(t_id,t_name) --教师编号,教师姓名 –4.成绩表 Score(s_id,c_id,s_score) --学生编号,课程编号,分数查询各科成绩前三名的记录 -- 1.选出b表比a表成绩大的所有组 -- 2.选出比当前id成绩大的 小于三个的 select a.s_id,a.c_id,a.s_score from sc
时间: 2024-04-15 16:28:36 浏览: 268
程序设计-“学生信息管理系统”的数据存储问题.pptx
Sure! You can achieve the desired result by using the following SQL query:
```sql
SELECT a.s_id, a.c_id, a.s_score
FROM Score a
WHERE (SELECT COUNT(*)
FROM Score b
WHERE b.c_id = a.c_id AND b.s_score > a.s_score) < 3;
```
This query will select the `s_id`, `c_id`, and `s_score` from the `Score` table where the count of records with a higher score for the same course is less than 3.
阅读全文