




版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、 數(shù)據(jù)庫(kù)課程設(shè)計(jì) 設(shè)計(jì)選題:網(wǎng)上書(shū)店管理系統(tǒng)班 級(jí):船海1101設(shè) 計(jì) 人:郭英豪學(xué) 號(hào):U201115491 輔導(dǎo)教師:董敏欽一、 需求分析1.1數(shù)據(jù)需求網(wǎng)上書(shū)店管理信息系統(tǒng)需要完成功能主要有:1. 各種書(shū)籍基本信息的輸入,包括書(shū)名,ISBN號(hào),出版年份,價(jià)格。2. 書(shū)籍基本信息的查詢、修改,包括書(shū)名,ISBN號(hào),出版年份,價(jià)格等。3. 書(shū)籍作者基本信息的輸入,包括姓名,地址,個(gè)人主頁(yè)。4. 書(shū)籍作者基本信息的查詢、刪除,包括姓名,地址,個(gè)人主頁(yè)等。5. 出版社信息的輸入,包括出版社名稱,地址,電話,網(wǎng)站等。6. 出版社基本信息的查詢、刪除,包括出版社名稱,地址,電話,網(wǎng)站等。7. 購(gòu)物車相
2、關(guān)信息的輸入,包括購(gòu)物車號(hào),購(gòu)買數(shù)量。8. 購(gòu)物車信息的查詢、修改,包括購(gòu)物車號(hào),購(gòu)買數(shù)量等。9. 消費(fèi)者相關(guān)信息的輸入,包括姓名,郵箱,地址,電話。10. 消費(fèi)者相關(guān)信息的查詢、修改,包括姓名,郵箱,地址,電話等。11. 倉(cāng)庫(kù)相關(guān)信息的輸入,包括倉(cāng)庫(kù)號(hào),地址,電話,存書(shū)量。12. 倉(cāng)庫(kù)相關(guān)信息的查詢、修改,包括倉(cāng)庫(kù)號(hào),地址,電話,存書(shū)量等。1.2事物需求(1)在書(shū)籍信息管理部分,要求:a.可以瀏覽書(shū)籍、作者及其出版社信息。b.可以對(duì)書(shū)籍、作者及其出版社信息進(jìn)行添加及刪除的操作。(2 )在圖書(shū)網(wǎng)上銷售信息管理部分,要求:a.可以查詢消費(fèi)者的相關(guān)信息以及他擁有的購(gòu)物車和購(gòu)書(shū)量的信息。b.可以對(duì)消
3、費(fèi)者的相關(guān)信息以及他擁有的購(gòu)物車和購(gòu)書(shū)量的信息進(jìn)行維護(hù),包括添加及刪除的操作。(3)在圖書(shū)倉(cāng)儲(chǔ)管理部分,要求:。a.可以瀏覽各個(gè)倉(cāng)庫(kù)的藏書(shū)信息。b.可以對(duì)倉(cāng)庫(kù)藏書(shū)信息進(jìn)行維護(hù)操作。2、 數(shù)據(jù)庫(kù)設(shè)計(jì)出版社作者2.1 實(shí)體模型:出版寫(xiě)作 1 1 N N圖書(shū) N N屬于購(gòu)買存放 M M 1 1倉(cāng)庫(kù)購(gòu)物車顧客2.2 ER圖到關(guān)系圖的轉(zhuǎn)換(其中帶下劃線的為主屬性)stosksshopping-basketcontainsauthorURLnameaddresswritten-byyearpublished-bypublishernamephoneaddressURLbooktitlepriceISBNn
4、umbershopping-basketbasketIDbasket-ofshopping-basketnameaddressemailphonenumberaddressphonecode2.3數(shù)據(jù)字典Author表book表btoa表btop表Publisher表customer表Shopping-basket表Btos表Warehouse表Btop表三、關(guān)系圖的建立四、功能實(shí)現(xiàn)4.1 創(chuàng)建數(shù)據(jù)庫(kù):create database bookshop;4.2創(chuàng)建數(shù)據(jù)表:(1)book表create table book (ISBN int primary key, title char(20)
5、, wyear smallint, price real );(2)author表create table author (name char(20), waddress char(40), URL char(50) primary key(name,waddress) );(3)btoa表create table btoa (ISBN int primary key, name char(20), waddress char(40), foreign key(ISBN)references book(ISBN), foreign key(name,waddress)references au
6、thor(name,waddress) );(4)publisher表create table publisher (name char(20) primary key, paddress char(40), phone int, URL char(50) );(5)btop表create table btop (ISBN int primary key, name char(20), foreign key(ISBN)references book(ISBN), foreign key(name)references publisher(name) );(6)customer表 create
7、 table customer (cemail char(50)primary key, name char(20), caddress char(40), phone int );(7)shopping_basket表 create table shopping_basket (basketID int primary key, cemail char(50), foreign key(cemail)references customer(cemail) );(8)btos表 create table btos (ISBN int, basketID int, number smallint
8、, primary key(ISBN,basketID), foreign key(ISBN)references book(ISBN), foreign key(basketID)references shopping_basket(basketID) );(9)warehouse表 create table warehouse (code smallint primary key, phone int, whaddress char(40) );(10)btow表 create table btow (ISBN int, code smallint, number smallint, pr
9、imary key(ISBN,code), foreign key(ISBN)references book(ISBN), foreign key(code)references warehouse(code) );五、數(shù)據(jù)操作(插入、查詢、刪除、修改、添加)5.1 插入(1) 向book表插入信息insert into book values('1644','追風(fēng)箏的人','2003','25');insert into student values('28317','致青春','2012
10、','29.8');insert into student values('838971','了不起的蓋茨比','1876','14.8');(2) 向author表插入信息insert into author values('菲茨杰拉德','華中科技大學(xué)','');insert into author values('胡塞尼','武漢大學(xué)','');insert into author values('
11、辛夷塢','華中農(nóng)業(yè)大學(xué)','');(3) 向btoa表插入信息insert into btoa values('1644','胡塞尼','武漢大學(xué)');insert into btoa values('28317','辛夷塢','華中農(nóng)業(yè)大學(xué)');insert into btoa values('838971','菲茨杰拉德','華中科技大學(xué)');(4) 向publisher表插入信息insert into p
12、ublisher values('朝華出版社','北京','63818440','');insert into publisher values('航空工業(yè)出版社','北京','120','');insert into publisher values('人民出版社','上海','110','www.ewen.cc');(5) 向btop表插入信息insert into btop values('
13、1644','人民出版社');insert into btop values('28317','朝華出版社');insert into btop values('838971','航空工業(yè)出版社');(6) 向customer表插入信息insert into customer values('11111','嘻嘻','湖南大學(xué)','114');insert into customer values('#39;,&
14、#39;哈哈','清華大學(xué)','911');insert into customer values('365282758','郭英豪','華中科技大學(xué)','119');(7) 向shopping_basket表插入信息insert into shopping_basket values('1','365282758 ');insert into shopping_basket values('2','')
15、;insert into shopping_basket values('3','11111 ');(8) 向btos表插入信息insert into btos values('1644','1','2');insert into btos values('28317','3','4');insert into btos values('838971','2','3');(9) 向warehouse表插入信息insert
16、 into warehouse values('1001','674382','武漢市');insert into warehouse values('1002','674383','長(zhǎng)沙市');insert into warehouse values('1003','674384',' 上海市');(10) 向btow表插入信息insert into btow values('1644','1002','800
17、');insert into btow values('28317','1003','女','10000');insert into btow values('838971','1001','女','500');5.2查詢(1)查詢價(jià)格低于28元的書(shū)籍的作者的相關(guān)信息:select author.*from author,btoa,bookwhere book.ISBN=btoa.ISBN and = and book.
18、ISBN in(select book.ISBN from book where price<28 );(2)查詢將致青春放入購(gòu)物車的顧客的相關(guān)信息select distinct customer.*from customer,shopping_basket,btos,bookwhere btos.basketID=shopping_basket.basketIDand shopping_basket.cemail=customer.cemailand btos.ISBN=(select book.ISBN from book where title='致青春');(3)
19、查詢地址在北京的出版社的名稱,電話,網(wǎng)頁(yè)select name,phone,URLfrom publisher where paddress='北京'(4)查詢所有書(shū)的倉(cāng)儲(chǔ)記錄,包括書(shū)的名字和倉(cāng)庫(kù)的地址,并將結(jié)果按倉(cāng)儲(chǔ)量降序排列select book.title,btow.*,warehouse.whaddressfrom book,btow,warehousewhere book.ISBN=btow.ISBN and btow.code=warehouse.codeorder by number desc;(5)查詢各個(gè)倉(cāng)庫(kù)的總倉(cāng)儲(chǔ)量select code 倉(cāng)庫(kù)代號(hào),SUM(
20、number) 總倉(cāng)儲(chǔ)量from btow group by code;(6)查詢名字姓 “郭”字的顧客的購(gòu)物車代號(hào)select name 姓名,basketID 購(gòu)物車代號(hào)from shopping_basket,customerwhere name like '郭%' and shopping_basket.cemail in(select cemail from customer where name like '郭%');5.3 創(chuàng)建視圖 (1)創(chuàng)建所有1001號(hào)倉(cāng)庫(kù)的藏書(shū)記錄的視圖create view shitu1(ISBN,書(shū)名,數(shù)量)as sel
21、ect btow.ISBN,title,numberfrom btow,book where btow.ISBN=book.ISBN and btow.code='1001'查看視圖中的記錄select * from shitu1;(2)創(chuàng)建視圖customer其中的內(nèi)容是收藏暗時(shí)間的消費(fèi)者信息,包括(姓名,郵箱,地址,電話),創(chuàng)建時(shí)加上with check optioncreate view customer2(姓名,郵箱,地址,電話)as select distinct ,customer.cemail,customer.caddress,cust
22、omer.phonefrom btos,book,shopping_basket,customerwhere shopping_basket.basketID=btos.basketID and shopping_basket.cemail=customer.cemail and btos.ISBN=(select ISBN from book where book.title='暗時(shí)間') with check option;查看視圖中的記錄select * from customer2; (3) 創(chuàng)建一個(gè)視圖,其中的內(nèi)容是每個(gè)倉(cāng)庫(kù)的總存書(shū)量create view cunshuliang(倉(cāng)庫(kù)號(hào),存書(shū)量)as select code,sum(number) from btow group by codewith check o
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年呼倫貝爾職業(yè)技術(shù)學(xué)院?jiǎn)握新殬I(yè)傾向性測(cè)試題庫(kù)匯編
- 2025年度土地互換與農(nóng)村土地制度改革合同
- 2025年度客戶價(jià)格保密與農(nóng)業(yè)科技合作開(kāi)發(fā)合同
- 2025年度工地食堂員工滿意度調(diào)查與提升承包合同
- 2025年度夫妻雙方子女撫養(yǎng)權(quán)及探望權(quán)離婚協(xié)議書(shū)
- 2025年度房屋贈(zèng)予與遺產(chǎn)分配協(xié)議
- 2025年度大型活動(dòng)臨時(shí)聘用保安人員合作協(xié)議
- 2025年度人工智能教育平臺(tái)建設(shè)合同變更協(xié)議
- 互聯(lián)網(wǎng)平臺(tái)限用農(nóng)藥違規(guī)售賣現(xiàn)狀調(diào)研報(bào)告
- 2025年度總經(jīng)理聘任與質(zhì)量管理體系合同:提升產(chǎn)品質(zhì)量合作協(xié)議
- 中醫(yī)醫(yī)療技術(shù)手冊(cè)2013普及版
- 腹部血管解剖-1
- 結(jié)構(gòu)化表達(dá)思維訓(xùn)練(完整版)
- 介紹南京大學(xué)
- 2022嗜酸粒細(xì)胞增多相關(guān)性肺疾病診療中國(guó)專家共識(shí)
- SYT 6925-2021 鉆井用天然氣發(fā)動(dòng)機(jī)及供氣站安全規(guī)程-PDF解密
- 養(yǎng)生館租賃協(xié)議合同
- 中考數(shù)學(xué)第二輪復(fù)習(xí)教案
- 供應(yīng)室停水停電應(yīng)急預(yù)案
- 《中醫(yī)常用護(hù)理技術(shù)基礎(chǔ)》課件-八綱辨證施護(hù)
- 魚(yú)燈非遺文化知識(shí)介紹
評(píng)論
0/150
提交評(píng)論