在成绩数据库ScoreDB中,根据给出的信息,可以进行以下查询:

  1. 查询少数民族同学中成绩不及格的阿学学号、姓名、民族、以及不及格的课程名、相应成绩:
SELECT Student.studentNo, Student.studentName, Student.nation, Course.courseName, Score.score
FROM Student
INNER JOIN Score ON Student.studentNo = Score.studentNo
INNER JOIN Course ON Score.courseNo = Course.courseNo
WHERE Student.nation = '阿' AND Score.score < 60;
  1. 查询选修了全第'08091'学期所开课程的学生学号、姓名和所在学院:
SELECT Student.studentNo, Student.studentName, Student.grade
FROM Student
INNER JOIN Class ON Student.classNo = Class.classNo
INNER JOIN Score ON Student.studentNo = Score.studentNo
INNER JOIN Course ON Score.courseNo = Course.courseNo
WHERE Course.term = '08091'
GROUP BY Student.studentNo, Student.studentName, Student.grade
HAVING COUNT(DISTINCT Score.courseNo) = (SELECT COUNT(*) FROM Course WHERE term = '08091');
  1. 查询既选修了'操作系统'又选修了'数据库系统'课程的学生学号、成绩及姓名:
SELECT s1.studentNo, s1.studentName, Score.score
FROM Student s1
INNER JOIN Score ON s1.studentNo = Score.studentNo
INNER JOIN Course c1 ON Score.courseNo = c1.courseNo
INNER JOIN (
    SELECT s2.studentNo
    FROM Student s2
    INNER JOIN Score ON s2.studentNo = Score.studentNo
    INNER JOIN Course c2 ON Score.courseNo = c2.courseNo
    WHERE c2.courseName = '操作系统'
) t1 ON s1.studentNo = t1.studentNo
WHERE c1.courseName = '数据库系统';

以上查询语句可以根据具体的数据库结构和数据进行调整,以适应实际的环境和需求。

学生成绩数据库查询示例 - SQL语句实现

原文地址: https://www.cveoy.top/t/topic/b9Qn 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录