学生表: Student 学生表 ( 学号,姓名,性别,年龄,组织部门

16 查阅

学生表: Student 学生表 ( 学号,姓名,性别,年龄,组织部门 )

Course 课程表 ( 编号,课程名称 )

Sc 选课表 ( 学号,课程编号,成绩 )

表结构如下:

(1). 写一个 SQL语句,查询选修了’计算机原理’的学生学号和姓名

(2). 写一个 SQL语句,查询’周星驰’同学选修了的课程名字

(3). 写一个 SQL语句,查询选修了 5门课程的学生学号和姓名

参考答案:

(1)

select sno,sname

from student

where sno in (

select sno

from sc

where cno = (

select cno

from course

where cname= 计算机原理

)

)

(2)

select cname

from course

where cno in (

select cno

from sc

where sno =

(

select sno

from student

where sname= 周星驰

)

)

(3)

select sno,sname

From student

Where sno in (

select sno

from scgroup by sno having count(sno)=5

)

暂无解析