![北郵數(shù)據(jù)庫實驗報告_第1頁](http://file3.renrendoc.com/fileroot_temp3/2022-2/4/bb6f07ea-fe58-416f-9a40-b30031de1f33/bb6f07ea-fe58-416f-9a40-b30031de1f331.gif)
![北郵數(shù)據(jù)庫實驗報告_第2頁](http://file3.renrendoc.com/fileroot_temp3/2022-2/4/bb6f07ea-fe58-416f-9a40-b30031de1f33/bb6f07ea-fe58-416f-9a40-b30031de1f332.gif)
![北郵數(shù)據(jù)庫實驗報告_第3頁](http://file3.renrendoc.com/fileroot_temp3/2022-2/4/bb6f07ea-fe58-416f-9a40-b30031de1f33/bb6f07ea-fe58-416f-9a40-b30031de1f333.gif)
![北郵數(shù)據(jù)庫實驗報告_第4頁](http://file3.renrendoc.com/fileroot_temp3/2022-2/4/bb6f07ea-fe58-416f-9a40-b30031de1f33/bb6f07ea-fe58-416f-9a40-b30031de1f334.gif)
![北郵數(shù)據(jù)庫實驗報告_第5頁](http://file3.renrendoc.com/fileroot_temp3/2022-2/4/bb6f07ea-fe58-416f-9a40-b30031de1f33/bb6f07ea-fe58-416f-9a40-b30031de1f335.gif)
下載本文檔
版權說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權,請進行舉報或認領
文檔簡介
1、數(shù)據(jù)庫實驗報告(二) 學號: 班級: 1. 按照給出的表用SQL Server Management Studio(企業(yè)管理器)建立表B-1, 表B-2, 表B-3book:class:course:2. 用Transact-SQL語句建立表B-5, 表B-6, 表B-7, 表B-8, 表B-9create table department (department_id nchar(10) not null primary key,department_name nchar(10),department_header nchar(10),teacher_num nchar(10)create
2、table student (student_id nchar(10) not null primary key,student_name nchar(10),sex nchar(10),birth nchar(10),entrance_date nchar(10),home_addr nchar(10),email nchar(10)create table student_course (course_id nchar(10) not null,student_id nchar(10) not null,grade nchar(10),credit nchar(10),semester n
3、char(10),school_year nchar(10),constraint C2 primary key(course_id,student_id)create table teacher (teacher_id nchar(10) not null primary key,teacher_name nchar(10),sex nchar(10),birth nchar(10),department_id nchar(10),profession nchar(10),telephone nchar(10),home_addr nchar(10),postalcode nchar(10)
4、,email nchar(10)create table teacher_course_class (teacher_id nchar(10) not null,course_id nchar(10) not null,class_id nchar(10) not null,semester nchar(10),school_year nchar(10),course_schedule nchar(10),course_classroom nchar(10),book_id nchar(10),constraint C3 primary key(teacher_id,course_id,cla
5、ss_id)結果圖:department:student:student_course:teacher: teacher_course_class:3. 為每個表建立主鍵。在建表的時候已經(jīng)建立。結果見上面的截圖。4. 對Course表建立如下約束:course_name非空,credit取值在1-6之間alter table course add constraint C1 check(credit between 1 and 6)5. 為student_course表、teacher_course_class表創(chuàng)建外鍵,建立參照完整性約束,分別用SQL Server Management S
6、tudio(企業(yè)管理器)和Transact-SQL語句完成。alter table student_course add constraint FK1 foreign key(course_id) references course(course_id),constraint FK2 foreign key(student_id) references student(student_id)on delete cascadealter table teacher_course_class add constraint FK3 foreign key(book_id)
7、160; references book(book_id), constraint FK4 foreign key(teacher_id) references teacher(teacher_id), constraint FK5 foreign key(course_id) references course(course_id), constraint FK6 foreign key(class_id) references class(class_id) on delete cascade6. 修改Student和teacher表,分別增加一列用于存儲學生和教師的E_mail地址。alter table student addemail char(20)alter table teacher addemail char(20)7. 創(chuàng)建Course2表,與course表結構一樣,刪除course2表。分別用SQL Server Management Studio(企業(yè)管理器)和T
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 北師大版道德與法治七年級下冊9.1《我們身邊的法律》聽課評課記錄
- 湘教版數(shù)學九年級下冊聽評課記錄:2.3 垂徑定理
- 小學二年級上冊數(shù)學口算練習題人教版新課標
- 小學二年級人教版口算及豎式計算寒假練習A4排版
- 小學二年級加減乘法口算練習題
- 蘇教版小學二年級數(shù)學上冊口算題卡
- 超市連鎖加盟合同范本
- 儲藏室租賃合同范本
- 汽車二級經(jīng)銷商合作協(xié)議書范本
- 二零二五年度美容學員美容行業(yè)技能提升培訓協(xié)議
- 高標準農(nóng)田施工組織設計(全)
- 宿舍、辦公樓消防應急預案
- 細胞全能性的課件資料
- 職業(yè)安全健康工作總結(2篇)
- 14S501-1 球墨鑄鐵單層井蓋及踏步施工
- YB 4022-1991耐火泥漿荷重軟化溫度試驗方法(示差-升溫法)
- 水土保持方案中沉沙池的布設技術
- 安全生產(chǎn)技術規(guī)范 第25部分:城鎮(zhèn)天然氣經(jīng)營企業(yè)DB50-T 867.25-2021
- 現(xiàn)代企業(yè)管理 (全套完整課件)
- 走進本土項目化設計-讀《PBL項目化學習設計》有感
- 高中語文日積月累23
評論
0/150
提交評論