學生表: 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
)
暫無解析