子查询操作,在数据库EDUC中实现查询: (1)求选修了高等数学的学生学号和姓名; (2)求C1 课程的成绩高于张三的学生学号和成绩; (3)求其他系中比计算机系学生年龄都小的学生信息; (4)求至少选修了学号为“1103”的学生所选修的全部课程的学生学号和姓名。
时间: 2023-11-10 10:38:11 浏览: 120
数据库-实验一-数据定义.pdf
1. SELECT s.student_id, s.student_name FROM student s WHERE s.student_id IN (SELECT e.student_id FROM enrollment e WHERE e.course_id = '高等数学');
2. SELECT e.student_id, e.score FROM enrollment e WHERE e.course_id = 'C1' AND e.score > (SELECT e1.score FROM enrollment e1 WHERE e1.student_id = '张三' AND e1.course_id = 'C1');
3. SELECT s.student_id, s.student_name, s.age FROM student s WHERE s.department <> '计算机系' AND s.age < (SELECT MIN(age) FROM student WHERE department = '计算机系');
4. SELECT DISTINCT e1.student_id, s.student_name FROM enrollment e1, enrollment e2, student s WHERE e1.student_id = s.student_id AND e2.course_id = e1.course_id AND e2.student_id = '1103';
阅读全文