資料庫系統概論 王珊第五版 實驗6答案

2022-11-21 16:42:02 字數 1974 閱讀 4319

實驗6答案

1.查詢名字中第2個字為『向』的學生姓名和學號及選修的課程號、課程名;

select from student a,course b,sc c

where like'_向%' and and

2.列出選修了『數學』或者『大學英語』的學生學號、姓名、所在院系、選修課程號及成績;

select from student a,course b,sc c

where in('數學','大學英語')and and

3.查詢與『張力』(假設姓名唯一)年齡不同的所有學生的資訊;

select * from student

where sage<>(select sage from student where sname='張力')

4.按照「學號,姓名,所在院系,已修學分」的順序列出學生學分的獲得情況。其中已修學分為考試已經及格的課程學分之和;

select as 已修學分

from student a,course b,sc c

where grade>60 and and

group by

5.查詢選修了至少一門和張力選修課程一樣的學生的學號、姓名及課程號;

select from student a,sc c

where cno in(select cno from sc where sno in(select sno from student where sname='張力'))

and6.查詢只被一名學生選修的課程的課程號、課程名;

select cno,cname from course

where cno in(select cno from sc group by cno h**ing count(*)=1)

7.使用巢狀查詢出選修了「資料結構」課程的學生學號和姓名;

select sno,sname from student

where sno in(select sno from sc where cno=(select cno from course where cname='資料結構'))

8.使用巢狀查詢查詢其它系中年齡小於cs系的某個學生的學生姓名、年齡和院系;

select sname,sage,sdept from student

where sageand sdept<>'cs'

9.使用any、all 查詢,列出其他院系中比wm系所有學生年齡小的學生的姓名;

select sname from student

where sageand sdept<>'wm'

10.分別使用連線查詢和巢狀查詢,列出與『張力』在乙個院系的學生的資訊;

select b.*from student a,student b

where '張力' and

或select * from student

where sdept in(select sdept from student where sname='張力')

11.使用集合查詢列出cs系的學生以及性別為女的學生學號及姓名;

select sno,sname from student

where sdept='cs'

union

select sno,sname from student

where s***='女'

12.使用集合查詢列出cs系的學生與年齡不大於19歲的學生的交集、差集;

select *

from student

where sdept='cs'

except

select *

from student

where sage<=19

select *

from student

where sdept='cs'

intersect

select *

from student

where sage<=19

資料庫系統概論離線作業

浙江大學遠端教育學院 第一章習題2 6 10 2.使用資料庫系統有什麼好處?答 使用資料庫系統的好處是由資料庫管理系統的特點或優點決定的。使用資料庫系統的好處很多,例如,可以大大提高應用開發的效率,方便使用者的使用,減輕資料庫系統管理人員維護的負擔,等等。使用資料庫系統可以大大提高應用開發的效率。因...

資料庫系統概論實習報告一

資料庫技術及應用 實驗報告一 學生姓名 學號院系 專業課程名稱資料庫技術及應用 任課教師 二0 年月日 用sql語句實現如下操作 1.在stu資料庫中,建立學生表s sno,sname,sage sno為主碼,sname取唯一值,資料如下 s1zhao19 s2qian23 s3sun34 s4li...

絡資料庫系統概論》教學大綱

課程名稱 網路資料庫系統概論 英文名稱 network database system concepts 學分 3總學時 60實驗 上機 學時 18開課專業 電子商務專業 一 課程性質 目的和培養目標 網路資料庫系統概論 是電子商務專業的專業課,主要討論資料庫系統的基本概念,基本原理以及有關的應用。...