第3章 SQL题目 - (第3章 SQL 习题 - 3.11)
发布时间
阅读量:
阅读量
3.11使用大学模式,用SQL写出如下查询。
a.找出所有至少选修了一门Comp. Sci. 课程的学生姓名,保证结果中没有重复的姓名。
with target_course(id, title) as (
select course_id, title from course where dept_name = 'Comp. Sci.'
)
select distinct name from takes natural join student
where course_id in (select id from target_course);
name
----------
Bourikas
Zhang
Shankar
Williams
Levy
Brown
(6 rows)
b.找出所有没有选修在2009年春季之前开设的任何课程的学生的ID和姓名。
with student_id(ID) as (
(select ID from
全部评论 (0)
还没有任何评论哟~
