超市管理系統(tǒng)數(shù)據(jù)庫設(shè)計數(shù)據(jù)庫設(shè)計報告_第1頁
超市管理系統(tǒng)數(shù)據(jù)庫設(shè)計數(shù)據(jù)庫設(shè)計報告_第2頁
超市管理系統(tǒng)數(shù)據(jù)庫設(shè)計數(shù)據(jù)庫設(shè)計報告_第3頁
超市管理系統(tǒng)數(shù)據(jù)庫設(shè)計數(shù)據(jù)庫設(shè)計報告_第4頁
超市管理系統(tǒng)數(shù)據(jù)庫設(shè)計數(shù)據(jù)庫設(shè)計報告_第5頁
已閱讀5頁,還剩52頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認(rèn)領(lǐng)

文檔簡介

《數(shù)據(jù)庫課程設(shè)計》論文題目:超市管理系統(tǒng)數(shù)據(jù)庫設(shè)計學(xué)號:專業(yè)班級:姓名:指導(dǎo)老師:完成日期:目錄《數(shù)據(jù)庫課程設(shè)計》論文摘要-1-引言-2-需求分析-2-任務(wù)-2-1.1處理對象 -2- 1.1.2處理功能要求 -2- 1.1.3安全性和完整性要求 -4-結(jié)果-4-1.2.1頂層數(shù)據(jù)流程圖-4- 1.2.2第一層流程圖 -5- 1.2.3第二層流程圖 -6- 1.2.4數(shù)據(jù)字典 -7-概念結(jié)構(gòu)設(shè)計-8-具體任務(wù)-8-階段結(jié)果-8-2.2.1各個實體的E-R圖-8-2.2.2分E-R圖-9-2.3全局 E-R圖-10-邏輯結(jié)構(gòu)設(shè)計-10-任務(wù)-10-3.1將E-R模型轉(zhuǎn)換為關(guān)系模型-10-結(jié)果-12-3.2.1將ER圖轉(zhuǎn)化為關(guān)系模式匯總-12-3.2.2外模式匯總-12-3.2.3系統(tǒng)功能模塊圖-14-4物理結(jié)構(gòu)設(shè)計-14-數(shù)據(jù)庫實施-14-5.1任務(wù)-14-5.2結(jié)果-15-5.2.1存儲過程匯總-15-5.2.2觸發(fā)器匯總-15-6調(diào)試與測試-16-附錄1數(shù)據(jù)字典說明-16-附錄1.1數(shù)據(jù)項說明-16-附錄1.2數(shù)據(jù)結(jié)構(gòu)-19-附錄1.3數(shù)據(jù)流-20-附錄1.4數(shù)據(jù)處理-21-附錄1.5數(shù)據(jù)存儲-22-附錄2關(guān)系模式說明-23-附錄3數(shù)據(jù)定義語句-27-附錄3.1基本表-27-附錄3.2視圖-29-附錄3.3存儲過程-31-附錄3.4觸發(fā)器-33-附錄4數(shù)據(jù)操縱驗證-34-4.1在SQLServerManagementstudio中驗證-35-4.2在PLSQLDeveloper中進行驗證-36-附錄5存儲過程與觸發(fā)器功能的驗證-37-5.1在SQLServerManagementstudio中-37-5.1.1觸發(fā)器驗證-37-1.2存儲過程的驗證 -40-5.2在PLSQLDeveloper中進行驗證-44-5.2.1存儲過程的驗證-44- 5.2.2觸發(fā)器的驗證 -48---4.14.1在SQLServerManagementstudio中驗證--1、增加銷售記錄CSinsertintoCSvalues('000000000','00000','SPFG000001',10,'2013-7-5','200013304')--2、增加會員信息CinsertintoCvalues('1085','是','李紅光','男','1988-2-3',0)--3、更新員工信息updateEsetEsalary=4000whereEno='20013302'--4、刪除員工信息deletefromEwhereEno='20013302'--5、查詢潘婷洗發(fā)水的損壞情況select*fromD_detailwhereTname='潘婷洗發(fā)水'4.2在PLSQLDeveloper中進行驗證--1、查詢SPFG000001號商品的銷售詳情select*fromsale_detailwhereTno='SPFG000001';附錄附錄5存儲過程與觸發(fā)器功能的驗證5.1在SQLServerManagementstudio中5.1.1觸發(fā)器驗證--驗證觸發(fā)器t1insertintoCSvalues('000000002','1001','SPFG000001',9,'2012-12-12','20013301')銷售前庫存信息:銷售后庫存信息:增加銷售信息:--驗證觸發(fā)器t2insertintoCSvalues('000000005','100000','SPFG000001',9,'2012-12-12','20013301')買東西前:買東西后:--驗證觸發(fā)器t3insertintointoPOvalues('000000005','SPFG000001','888000',9,'2012-12-12','20013301')采購后庫存信息:采購記錄:--驗證觸發(fā)器t4insertintoPBvalues('000000001','SPFG000001',9,'2012-12-12','簡直糟糕透了!')退貨后:退貨記錄:--驗證觸發(fā)器t5insertintoCBvalues('000002','1003','SPFG000001','2012-12-12',9,'糟糕,尺碼太大!')執(zhí)行結(jié)果:顧客退貨后的庫存記錄:顧客退貨記錄:--驗證觸發(fā)器t6insertintoDvalues('SPFG000001','8',9,'放太久,過期了!')增加后的庫存記錄:增加的報損信息:5.1.2存儲過程的驗證--1、驗證存儲過程no_salesexecno_salesSPFG000001--2、驗證存儲過程no_saverexecno_saveSPFG000008--3、驗證存儲過程name_detailexecname_detail潘婷洗發(fā)水--4、驗證存儲過程delete_Eexecdelete_E'20013305'--5、驗證存儲過程delete_Cexecdelete_C'1008'--6、驗證存儲過程T_destoryexecT_destory'SPFG000001'--7、驗證存儲過程select_criditexecselect_cridit'1008'--8、驗證存儲過程select_saleexecselect_saleSPFG000001,'2012-12-12','2013-7-5'5.2在PLSQLDeveloper中進行驗證5.2.1存儲過程的驗證--1、輸入商品號,查詢該商品的銷售情況、利潤createorreplaceprocedureno_sales(TnoinT.Tno%type,Tnumoutnumber,Tsaleoutnumber,Tprofitoutnumber)isbeginselectsum(CSnum)銷售量,SUM(CSnum*T.TSprice)銷售總額,SUM(CSnum*(T.TSprice-TPprice))利潤intoTnum,Tsale,Tprofitfromsale_detail,TwhereT.Tno=sale_detail.Tno;dbms_output.put_line(Tno||''||Tnum||''||Tsale||''||Tprofit);end;驗證:declareTnoT.Tno%type:='SPFG000001';Tnumnumber;Tsalenumber;Tprofitnumber;beginno_sales(Tno,Tnum,Tsale,Tprofit);no_sales(Tno,Tnum,Tsale,Tprofit);end;驗證結(jié)果:--2、輸入商品號,查詢該商品的庫存量createorreplaceprocedureno_save(tTnoinW_save.Tno%type,WnooutW_save.Wno%type,TnameoutW_save.Tname%type,WsaveoutW_save.wsave%type,TunitoutW_save.Tunit%type,TSpriceoutW_save.TSprice%type)isbeginselectWno,Tname,Wsave,Tunit,TSpriceintoWno,Tname,Wsave,Tunit,TSpricefromW_savewhereTno=tTno;dbms_output.put_line(tTno||''||Wno||''||Tname||''||Wsave||''||Tunit||''||TSprice);end;驗證:declaretTnoW_save.Tno%type:='SPFG000001';WnoW_save.Wno%type;TnameW_save.Tname%type;TsaveW_save.wsave%type;TunitW_save.Tunit%type;TSpriceW_save.TSprice%type;beginno_save(tTno,Wno,Tname,Tsave,Tunit,TSprice);end;驗證結(jié)果:--3、輸入商品名,查詢商品的詳細(xì)信息,供應(yīng)商、關(guān)于地址等createorreplaceprocedurename_deta(tTnoinT.TNO%type,tTnameoutT.Tname%type,tTSpriceoutT.Tsprice%type,tTprodateoutT.TPRODATE%type,tTkeepDateoutT.Tkeepdate%type,tSnameoutS.SNAME%type,tSaddressoutS.SADDRESS%type,tSphoneoutS.SPHONE%type)isbeginselectT.Tname,TSprice,TproDate,TkeepDate,Sname,Saddress,SphoneintotTname,tTSprice,tTproDate,tTkeepDate,tSname,tSaddress,tSphonefromT,S,STfromT,S,STwhereT.Tno=ST.TnoandS.Sno=ST.SnoandtTno=T.TNO;dbms_output.put_line(tTno||''||tTname||''||tTSprice||''||to_char(tTproDate)||''||tTkeepDate||''||tSname||''||tSaddress||''||tSphone);end;declaretTnoT.TNO%type:='SPFG000001';tTnameT.Tname%type;tTSpriceT.Tsprice%type;tTprodateT.TPRODATE%type;tTkeepDateT.Tkeepdate%type;tSnameS.SNAME%type;tSaddressS.SADDRESS%type;tSphoneS.SPHONE%type;beginname_deta(tTno,tTname,tTSprice,tTproDate,tTkeepDate,tSname,tSaddress,tSphone);end;驗證結(jié)果:--4、創(chuàng)建存儲過程,查詢類型為“生活用品”的商品信息以及庫存信息createorreplaceprocedurep3istTnoT.TNO%type;tTnameT.TNAME%type;tTSpriceT.TSPRICE%type;tTunitT.TUNIT%type;tWsaveTW.WSAVE%type;cursorc1isselectT.Tno,Tname,TSprice,Tunit,WsavefromT,TWwhereT.Tno=TW.TnoandTtype='生活用品';beginopenc1;loopfetchc1intotTno,tTname,tTSprice,tTunit,tWsave;exitwhenc1%notfound;dbms_output.put_line(tTno||''||tTname||''||tTSprice||''||tTunit||''||tWsave);endloop;closec1;closec1;end;驗證:declaretTnoT.TNO%type;tTnameT.TNAME%type;tTSpriceT.TSPRICE%type;tTunitT.TUNIT%type;tWsaveTW.WSAVE%type;beginp3;end;驗證結(jié)果:--5、給出商品號,查詢在某一時期商品的銷售情況createorreplaceprocedureselect_sale(ttnoT.TNO%type,startTimedate,endTimedate)istsumnumber;salenumber;beginselectsum(CSnum)intotsumfromsale_detailwhereTno=ttnoandTnoin(selectTnofromCSwhereCStimebetweenstartTimeandendTime)groupbyTno;selecttsum*TSpriceintosaleintosalefromTwhereTno=ttno;dbms_output.put_line(tTno||''||tsum||''||sale);end;驗證:declarettnoT.TNO%type:='SPFG000001';startTimedate:=to_date('2012-12-12','yyyy-mm-dd');endTimedate:=to_date('2013-7-5','yyyy-mm-dd');tsumnumber;salenumber;ttspricenumber;beginselect_sale(ttno,startTime,endTime);end;驗證結(jié)果:5.2.2觸發(fā)器的驗證--1、當(dāng)銷售出商品時,就修改庫存商品信息createorreplacetriggert1afterinsertonCSforeach

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論