數(shù)據(jù)系統(tǒng)原理第一次作業(yè)
第一次作業(yè)
?
具體要求:
1、作業(yè)組織:先在作業(yè)本完成每題的答題,再將作業(yè)本中的每頁答題拍照貼到答題卡文件相應(yīng)位置,答題卡文件命名:學(xué)號姓名-第1次作業(yè).doc(例如學(xué)號張三-第1次作業(yè).doc),注意排版格式。
2、遞交方式:在【優(yōu)學(xué)院】—【作業(yè)】相應(yīng)欄目上傳自己的作業(yè)答題卡文件供老師批改,批改后返回給大家再上傳到網(wǎng)安學(xué)院作業(yè)系統(tǒng)的相關(guān)欄目。(注意:時間限制)。
?
? ? ????????????????????????????????????????????????????????第1章 數(shù)據(jù)庫系統(tǒng)概述
?
1.指出下列縮寫的含義:
(1)DML:數(shù)據(jù)操縱語言
(2)DBMS:數(shù)據(jù)庫管理系統(tǒng)
(3)DDL:?數(shù)據(jù)定義語言
(4)DB:數(shù)據(jù)庫
(5)DBS:數(shù)據(jù)庫系統(tǒng)
(6)DBA:數(shù)據(jù)庫管理員
?
2. 數(shù)據(jù)庫系統(tǒng)中人員主要包括(數(shù)據(jù)庫管理員)、(數(shù)據(jù)分析員和數(shù)據(jù)庫設(shè)計人員)、(應(yīng)用程序員)和(用戶)。
?
3.DBS組成部分包括(數(shù)據(jù)庫)、(數(shù)據(jù)庫管理系統(tǒng))、(應(yīng)用系統(tǒng))、(數(shù)據(jù)庫管理員)、(用戶)五部分。
?
4.DBMS是位于(操作系統(tǒng))和(用戶)之間的一層管理軟件。
?
5.數(shù)據(jù)庫和文件的根本區(qū)別是(實現(xiàn)數(shù)據(jù)的整體結(jié)構(gòu)化)。
?
6.DBMS提供的數(shù)據(jù)控制功能包括(安全性保護(hù))、(完整性檢查)、(并發(fā)控制)、(數(shù)據(jù)庫恢復(fù))。
?
7.數(shù)據(jù)庫中,數(shù)據(jù)模型用于(描述數(shù)據(jù)結(jié)構(gòu)、數(shù)據(jù)操作及數(shù)據(jù)約束的數(shù)據(jù)形式體系),數(shù)據(jù)模型應(yīng)當(dāng)滿足(比較真實地模擬現(xiàn)實世界)、(容易被人所理解)、(便于在計算機上實現(xiàn))三方面要求。
?
8.數(shù)據(jù)模型的三要素包括(數(shù)據(jù)結(jié)構(gòu))、(數(shù)據(jù)操作)、(數(shù)據(jù)完整性約束)。
?
9.概念模型也稱為(信息模型),是(按用戶的觀點或認(rèn)識對現(xiàn)實世界的數(shù)據(jù)和信息進(jìn)行建模),主要用于(數(shù)據(jù)庫設(shè)計),與具體的DBMS和機器(無關(guān))。
?
10.數(shù)據(jù)的獨立性是指(應(yīng)用程序和數(shù)據(jù)結(jié)構(gòu)之間相互獨立, 互不影響),可以分為(邏輯獨立性)和(物理獨立性)。
????????????????????????????????????????????????????????第2章?關(guān)系模型與關(guān)系代數(shù)


?
(1) ?(∏studentName, birthday, courseNo(Student???Score))÷(∏courseNo(σstudentNo='1501001'(Score)))
(2) ?((∏studentNo, courseNo(Score))÷(∏courseNo(σcourseNo LIKE 'CS%'(Course))))???Score
?
2.8 ?對于圖2-8所示的成績管理數(shù)據(jù)庫ScoreDB的模式導(dǎo)航圖,根據(jù)圖2-11所示的實例數(shù)據(jù),試寫出如下查詢的關(guān)系代數(shù)表達(dá)式,并給出其查詢結(jié)果。
(1) 查找籍貫為“上?!?/strong>的全體學(xué)生。
σnative='上海'?(Student)
?
(2) 查找2000年元旦以后出生的全體男同學(xué)。
σyear(birthday)>=2000∧sex='男'?(Student)? ?
?
(3) 查找信息學(xué)院非漢族同學(xué)的學(xué)號、姓名、性別及民族。
????????Class表???????Student表???????以學(xué)生表Student為中心
∏studentNo, studentName, sex, nation ((σnation!='漢族'?Student) ??(σinstitute='信息學(xué)院'?Class))
?
(4) 查找2016-2017學(xué)年第二學(xué)期(16172)開出課程(即16172學(xué)期學(xué)生選修了的課程)的編號、名稱和學(xué)分。——以課程表Course或成績表Score為中心
∏courseNo,?courseName, courseHour?(Course???(σterm='16172'?Score))
?
(5) 查找選修了“操作系統(tǒng)”的學(xué)生學(xué)號、成績及姓名。
——以成績表Score為中心
∏studentNo, studentName, score?(Student???Score???(σcourseName='操作系統(tǒng)'?Course))
?
(6) 查找班級名稱為“會計學(xué)15(3)班”的學(xué)生在2015-2016學(xué)年第一學(xué)期(15161)選課情況,要求顯示學(xué)生姓名、課程號、課程名稱和成績。
——以成績表Score為中心
∏studentName, courseNo, courseName, score?(
(σclassName='會計學(xué)15(3)班'Class)???Student???(σterm='15161'Score) ??Course)
或
∏studentName, courseNo, courseName, score?(
σclassName='會計學(xué)15(3)班'∧term='15161'(Class???Student???Score???Course))
?
?
?
(7) 查找至少選修了一門其直接先修課編號為CS012的課程的學(xué)生學(xué)號和姓名。 ??????????
?——以成績表Score為中心
∏studentNo, studentName?(Student???Score???(σpriorCourse='CS012'Course))
?
?
請分析以下查詢:
(∏studentNo, studentName,courseNo?(Student???Score))÷(∏courseNo?(σpriorCourse='CS012'Course))
或 ∏studentNo, studentName(
((∏studentNo, courseNo Score)÷(∏courseNo?(σpriorCourse='CS012'Course)))???Student)
——查找選修了所有直接先修課編號為CS012的課程的學(xué)生學(xué)號和姓名
?
?(8) 查找選修了2016-2017學(xué)年第一學(xué)期(16171)開出的全部課程的學(xué)生學(xué)號、姓名。 ????——以成績表Score為中心
(∏studentNo, studentName, courseNo?(Student???Score))÷(?∏courseNo?(σterm='16171'Score))
?
——查找選修了2016-2017學(xué)年第一學(xué)期(16171)開出的全部課程的學(xué)生學(xué)號、姓名以及所選修所有課程的課程號、課程名、學(xué)期、成績。
∏studentNo, studentName, courseNo, courseName, term, score(
((∏studentNo, studentName, courseNo(Student???Score))÷(?∏courseNo(σterm='16171'Score)))
??Score???Course)
——查找2016-2017學(xué)年第一學(xué)期選修了2016-2017學(xué)年第一學(xué)期(16171)開出的全部課程的學(xué)生學(xué)號和姓名
?(∏studentNo, studentName, courseNo(Student???(σterm='16171'Score)))
÷(∏courseNo(σterm='16171'Score))
?
或
∏studentNo, studentName?(?(Student???Score)÷( ∏courseNo?(σterm='16171'Score))?)
包含除數(shù)表的所有元組中<被除數(shù)表中的屬性-除數(shù)表中的屬性>的值是否都相等???
(9) 查找至少選修了學(xué)號為1503010的學(xué)生所選課程的學(xué)生學(xué)號和姓名。
——以成績表Score為中心
(∏studentNo, studentName, courseNo?(Student???Score))
÷(∏courseNo(σstudentNo='1503010'Score))
或
∏studentNo, studentName(
((∏studentNo, courseNoScore)÷(∏courseNo(σstudentNo='1503010'Score)))???Student)
?
2.9 ?對于圖2-10所示的學(xué)生選課數(shù)據(jù)庫SCDB的模式導(dǎo)航圖,試寫出如下查詢的關(guān)系代數(shù)表達(dá)式。
(1) 查找2016級蒙古族學(xué)生信息,包括學(xué)號、姓名、性別和所屬班級。
——以學(xué)生表Student為中心
∏studentNo, studentName,?sex, classNo?(?(σnation='蒙古族'?Student) ??(σgrade=2016 Class)?)
?
?
(2) 查找“C語言程序設(shè)計”課程的課程班號、上課時間以及上課地點。
∏cClassNo,?time,?location?((σcourseName='C語言程序設(shè)計'Course)???CourseClass???Classroom)
?
(3) 查找選修了以“計算機概論”課程為其直接先修課的課程的學(xué)生學(xué)號、課程號和成績。——以選課表SC為中心
∏studentNo, courseNo, score?(?SC??
∏A.courseNo((Course?AS A)??A.priorCourse=B.courseNo?((σcourseName='計算機概論'Course)?AS B))?)
或
∏studentNo, SC.courseNo, score?(?SC??SC.courseNo=A.courseNo
((Course?AS A)??A.priorCourse=B.courseNo?((σcourseName='計算機概論'Course)?AS B))?)
即(其中,ρACourse表示將關(guān)系Course更名為A)
∏studentNo, SC.courseNo, score?(?SC??SC.courseNo=A.courseNo
((ρACourse)??A.priorCourse=B.courseNo?(σcourseName='計算機概論'(ρBCourse)))?)
請思考如下查詢的功能:
∏studentNo,?studentName, courseNo,?score(SC?((∏studentNo, studentName,?courseNo(Student?SC))÷
(∏A.courseNo((ρACourse)??A.priorCourse=B.courseNo?(σcourseName='計算機概論'(ρBCourse))))))
——查找選修了所有以“計算機概論”課程為其直接先修課的課程的學(xué)生的所有選課信息(包含學(xué)號、姓名、課程號和成績)。
?
(4) 查找李勇老師2016-2017學(xué)年第二學(xué)期(16172)開出的課程號、課程名和學(xué)分。——以開課班表CourseClass為中心
∏courseNo,?courseName, creditHour?(?
Course???(σterm='16172'CourseClass)???(σteacherName='李勇'Teacher) )
?
(5) 查找信息學(xué)院學(xué)生選課情況,要求顯示學(xué)生姓名、課程號、課程名、課程班號、成績和任課教師。——以選課表SC為中心
?
∏studentName, courseNo,?courseName, cClassNo, score,?teacherName?(?
((Student???∏classNo(Class ??σinstituteName='信息學(xué)院'Institute))???SC
??CourseClass???Teacher)???Course )
或:
∏studentName, courseNo,?courseName, cClassNo, score,?teacherName?(?
((Student???Class ??σinstituteName='信息學(xué)院'Institute)???SC
??CourseClass??CourseClass.teacherNo=Teacher.?teacherNo?Teacher)???Course )
?