我正在尝试提供一个列表,其中包含参加过系统分析和项目管理课程的学生。
当我单独选择“系统分析”或“项目管理”时,它会给我结果,但不是我需要的。我需要参加过这两门课程的学生。
SELECT FIRST_NAME, LAST_NAME, PHONE
FROM STUDENT d,ENROLLMENT f,SECTION g,COURSE h
WHERE d.STUDENT_ID = f.STUDENT_ID AND f.SECTION_ID = g.SECTION_ID AND g.COURSE_NO = h.COURSE_NO
AND h.DESCRIPTION = 'Systems Analysis' AND h.DESCRIPTION = 'Project Management'
AND DESCRIPTION NOT IN
(SELECT m.DESCRIPTION
FROM STUDENT z,ENROLLMENT b,SECTION w,COURSE m
WHERE z.STUDENT_ID = b.STUDENT_ID AND b.SECTION_ID = w.SECTION_ID AND w.COURSE_NO = m.COURSE_NO
AND m.DESCRIPTION = 'Systems Analysis' AND m.DESCRIPTION = 'Project Management')
ORDER BY FIRST_NAME, LAST_NAME, PHONE;
但是当我同时选择“系统分析”和“项目管理”时,它没有给我任何行
SELECT FIRST_NAME, LAST_NAME, PHONE
FROM STUDENT d,ENROLLMENT f,SECTION g,COURSE h
WHERE d.STUDENT_ID = f.STUDENT_ID AND f.SECTION_ID = g.SECTION_ID AND g.COURSE_NO = h.COURSE_NO
AND h.DESCRIPTION = 'Systems Analysis' AND h.DESCRIPTION = 'Project Management'
AND DESCRIPTION NOT IN
(SELECT m.DESCRIPTION
FROM STUDENT z,ENROLLMENT b,SECTION w,COURSE m
WHERE z.STUDENT_ID = b.STUDENT_ID AND b.SECTION_ID = w.SECTION_ID AND w.COURSE_NO = m.COURSE_NO
AND m.DESCRIPTION = 'Systems Analysis' AND m.DESCRIPTION = 'Project Management')
ORDER BY FIRST_NAME, LAST_NAME, PHONE;
如何提供一个包含已参加系统分析和项目管理课程的学生的列表而不给我任何行?