




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
1、7A 版優(yōu)質(zhì)實用文檔圖書管理系統(tǒng)姓名:賀文妹班級:計軟 1401學號: 需求:管理員模塊:1)登錄2)圖書管理(可以進行增、刪、改、查)3)用戶管理(可以進行增、刪、改、查)4)期刊管理(可以進行增、刪、改、查)用戶模塊:1)登錄2)圖書、期刊信息查詢2. 分析:這個系統(tǒng)至少要 5 張表:1.圖書基本信息表(存放圖書的基本信息,書名,書號,作者,狀態(tài)之 類)2.期刊基本信息表(存放圖書的基本信息,書名,書號,作者,狀態(tài)之 類)3. 用戶信息表(存放學生學號,姓名,密碼之類的)4. 管理員基本信息表(存放學生學號,姓名,密碼之類的)7A 版優(yōu)質(zhì)實用文檔7A 版優(yōu)質(zhì)實用文
2、檔5.用戶借閱信息表(學生借書記錄信息表)用戶數(shù)據(jù)項名數(shù)據(jù)項含義數(shù)據(jù)類型長度說明學號學號定長字符32密碼用戶密碼可變字符64姓名用戶的姓名可變字符64狀態(tài)用戶狀態(tài)定長整型2鎖定用戶賬戶7A 版優(yōu)質(zhì)實用文檔27A 版優(yōu)質(zhì)實用文檔管理員數(shù)據(jù)項名數(shù)據(jù)項含義數(shù)據(jù)類型長度說明賬號管理員賬號可變字符32密碼管理員密碼可變字符32圖書數(shù)據(jù)項名數(shù)據(jù)項含義數(shù)據(jù)類型長度說明書號圖書的編號定長字符8書名書的名字可變字符32作者書的作者可變字符32位置藏書位置可變字符32狀態(tài)書的狀態(tài)定長整型2標記該書是否可借期刊數(shù)據(jù)項名數(shù)據(jù)項含義數(shù)據(jù)類型長度說明期刊號期刊的編號定長字符8期刊名期刊的名字可變字符32作者期刊的作者可變
3、字符32位置期刊存放位置可變字符32狀態(tài)期刊的狀態(tài)定長整型2標記該期刊是否可借借閱信息數(shù)據(jù)項名數(shù)據(jù)項含義數(shù)據(jù)類型長度說明7A 版優(yōu)質(zhì)實用文檔37A 版優(yōu)質(zhì)實用文檔學號用戶的學號可變字符32書號書或期刊號可變字符8時間借閱時間時間類型記錄用戶借閱時間5. 數(shù)據(jù)庫選擇: Oracle6. 數(shù)據(jù)表的定義:/ 學生表的定義7. Create table students(8. stuNo char(8),9. stuName varchar2(32),10. stuPassword varchar2(32) ,11. stuStatusint(2) default 112. );13. / 創(chuàng)建查詢所
4、有學生信息的視圖14. Create or replace view view_select_student15. As16.Select stuNo as 學號, stuName as 姓名, stuPassword as 密碼, stuStatus as 狀態(tài)17.From students;18./ 調(diào)用視圖:19.Select G from view_select_student;20. / 創(chuàng)建查詢單個學生基本信息的過程21. Create or replace procedure proc_select_one(sNo in7A 版優(yōu)質(zhì)實用文檔7A 版優(yōu)質(zhì)實用文檔students.
5、stuNo%TYPE)22. As23. No_result eGception,24. sNo students.stuNo.%TYPE,25. sNamestudents.stuName%TYPE,26. stuPassstudents.stuPassword%TYPE,27. stuStastudents.stuStatus%TYPE;28. Begin29. Select stuNo into sNo,stuName into sName,30. stuPass into stuPass, stuStatus into stuSta31. From students where stu
6、No=sNo;32.If SQL%NOTFOUND then33. Rasieno_result;34. End if;35. DBMS_OUTPUT.PUTLINE( 學 號 |sNo| 姓 名 |sName| 密 碼 |stuPass| 狀態(tài) |stuSta);36. EGception37. When no_result then38. DBMS_OUTPUT.PUT_LINE( 你需要的數(shù)據(jù)不存在 );39. When others then40. DBMS_OUTPUT.PUT_LINE( 發(fā)生其它錯誤 );41. End proc_select_one;42. / 調(diào)用存儲過程43
7、. EGecute proc_select_one(sNo);7A 版優(yōu)質(zhì)實用文檔7A 版優(yōu)質(zhì)實用文檔44. / 創(chuàng)建刪除 sql45. Delete from students where stuNo=46. / 創(chuàng)建修改信息的 sql47.UpdatestudentssetwherestuNo= ,stuName= ,stuPassword= ,stuStatus= stuNo= 48./ 插入學生基本信息49.Insert into students (stuNo,stuName,stuPassword,stuStatus) values ();50.建學生表過程及運行結(jié)果截圖:51.5
8、2.53.54./ 管理員信息表55. Create table adminers(56. adName varchar2(32),57. adPassword varchar2(32)58. );59. / 查看管理員60. Create or replace view view_select_adminers61. As62.Select adName as 用戶名 ,adPassword as 密碼 from adminers;63./ 調(diào)用視圖7A 版優(yōu)質(zhì)實用文檔7A 版優(yōu)質(zhì)實用文檔64.Select G from view_select_adminers;/ 借閱信息表65. Cre
9、ate table stuBooksMagazines(66. stuNo char(8),67. borrowId char(8),/ ( stuNo,borrowId 作為主鍵)68. borrowTime date69. );70. / 查詢視圖的定義71. Create or replace view view_select_sBM72. As73.Select stuNo as 學號, stuName, as 姓名 ,74. borrowId as 書號, borrowName as 書名,from75. borrowTime as 借 閱 時 間 stuBooksMagazines
10、,books/magazines76. Where stuBooksMagazines.stuNo=students.stuNo77. and78. stuBooksMagazines.borrowId=books.bookId/magazines.magazin e.Id79. / 調(diào)用視圖80.Select G from view_select_sBM;81. / 刪除 sqland82. Delete from stuBooksMagazines where stuNo= borrowId= ” ;83. / 創(chuàng)建添加數(shù)據(jù)的存儲過程7A 版優(yōu)質(zhì)實用文檔7A 版優(yōu)質(zhì)實用文檔84. Crea
11、te or replace procedure proc_insert_sBM85. (sN in stuBooksMagazines.stuNo%type,86. bI in stuBooksMagazines.borrowId%type)87. As88. Begin89.Insert into stuBooksMagazines (stuNo,borrowId,borrowTime)90. Values (sN,bI,date();91. If SQL%ROWCOUNT then92. DBMS_OUTPUT.PUTLINE( 添加成功 );93. Else94. DBMS_OUTPUT
12、.PUTLINE( 添加失敗 );95. End proc_insert_sBM;96. EGecute proc_insert_sBM(sNo,bId);97. 建借閱信息表過程及運行結(jié)果截圖:98.99.100.101.102.103./ 圖書表的定義Create table books( bookId char(8), bookName varchar(32),7A 版優(yōu)質(zhì)實用文檔7A 版優(yōu)質(zhì)實用文檔bookAuthor varchar(32),bookLocation varchar(32),bookStatusint(2) default 1,Constraint gen_check
13、 check(bookStatus in (0,1) );/ 查詢視圖定義Create or replace view view_select_books asSelect bookId,bookName,bookAuthor,bookLocation,bookStatus books ;/ 操作查詢視圖的語句Select G from view_select_books;/ 修改語句Update booksbookId= ,bookName= ,bookAuthor= ,bookLocation= where bookName= ;/ 添加語句fromsetInsertinto(bookId
14、,bookName,bookAuthor,bookLocation,bookStatus)booksvalues);/ 刪除語句Delete from books where bookName=建圖書表過程及運行結(jié)果截圖:7A 版優(yōu)質(zhì)實用文檔7A 版優(yōu)質(zhì)實用文檔Create table magazines( magazineId char(8), magazineName varchar2(32), magazineAuthor varchar2(32), magazineLocation varchar2(32), magazineStatusint(2) default 1,Constra
15、int gen_check check(magazineStatus in(0,1);/ 查詢視圖定義:Create or replace view view_select_magazinesAsSelect magazineId,magazineName,magazineAuthor,magazineLocation,magazi neStatus from magazines;/ 操作視圖的語句Select G from view_select_magazines;/ 修改語句Update magazines set magazineId= ,magazineName= ,magazine
16、Author= ,magazine Location= where magazineName= ;/ 添加語句10Insert into magazines7A 版優(yōu)質(zhì)實用文檔7A 版優(yōu)質(zhì)實用文檔(magazineId,magazineName,magazineAuthor,magazineLocation,magazi neStatus) values ( ,);/ 刪除語句Delete from magazines where magazineName= ;/ 創(chuàng)建刪除指定期刊名的存儲過程Create or replace procedure proce_delete_magazine(m
17、agaId in magazine.magazineID%type)AsNo_result EGception;BeginDelete from magazine where magazineId=magaId;If SQL%NOTFOUND thenRaise no_result;End if;DBMS_OUTPUT.PUT_LINE( 期刊號為 |magaId| 書刊以被 刪除);EGceptionWhen no_result then DBMS_OUTPUT.PUT_LINE( 該書刊不存在 );When others thenDBMS_OUTPUT.PUTLINE( 發(fā)生其它錯誤 );
18、End proce_delete_magazine/ 調(diào)用數(shù)據(jù)庫里的存儲過程11EGecute proce_delete_magazine(magazineId);7A 版優(yōu)質(zhì)實用文檔7A 版優(yōu)質(zhì)實用文檔建期刊表過程及運行結(jié)果截圖:7.實習總結(jié) 這個星期是我們 SQL Server 數(shù)據(jù)庫管理課的上機實訓, 說實話,我們也是臨時 得知的,因為就在上周,我們剛經(jīng)歷了 JAVA 上機實習,那個禮拜真的很痛苦, 因為要做一個系統(tǒng), 每個人的題目是定好了的。 而數(shù)據(jù)庫實習題目是自己想, 所 以一開始我一點頭緒都沒,后來,在和同學的聊天中,我無意中有了靈感,為什 么不利用自己手頭的資源, 之前做過了一個系統(tǒng)。 所以,我選的這個題目就是從 之前 JAVA 上機實習中選的,可能我們班很多人也是這么做的吧。 經(jīng)過一個星期的實訓, 我對數(shù)據(jù)庫這門課程有了更深的了解, 簡單的說下我的理 解吧,我覺得就是創(chuàng)建一些表格, 然后再用一些語句根據(jù)它們之間的關(guān)系, 把它 們組合在一起。 這次我的實訓內(nèi)容是從數(shù)據(jù)庫, 數(shù)據(jù)表的創(chuàng)建和修改開始的, 表 是建立關(guān)系數(shù)據(jù)庫的基本結(jié)構(gòu), 用來存儲數(shù)據(jù)具有已定義的屬性, 在表的操作過 程中,有查看表信息,查看表屬性,修改表
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 冷藏合同范本
- 加工車間轉(zhuǎn)租合同范本
- 不見面簽訂租賃合同范本
- 2025年合肥貨運車從業(yè)考試題
- 個人施工承攬合同范本
- app開發(fā)合同范本模板
- 加工訂單合同范本模板
- 農(nóng)村供熱服務合同范本
- 個人股權(quán)質(zhì)押合同范本
- 光租船合同范本
- 黃龍溪古鎮(zhèn)文化旅游發(fā)展現(xiàn)狀與對策研究
- JT-T-1045-2016道路運輸企業(yè)車輛技術(shù)管理規(guī)范
- 2024年事業(yè)單位衛(wèi)生系統(tǒng)(護理學)招聘考試題庫與答案
- 互聯(lián)網(wǎng)金融 個人網(wǎng)絡消費信貸 貸后催收風控指引
- 2024年重慶市銅梁區(qū)龍都水資源開發(fā)有限責任公司招聘筆試參考題庫附帶答案詳解
- 體檢科健康管理案例分析
- 涼山州西昌市人民醫(yī)院招聘臨床護理人員考試試題及答案
- 2024年輔警招聘考試試題庫附完整答案(必刷)
- 會議記錄表格樣本
- 2024年中考記敘文閱讀題及答案5篇
- 馬工程《藝術(shù)學概論》
評論
0/150
提交評論