




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
1、*級(jí)*專業(yè)*班數(shù)據(jù)庫應(yīng)用系統(tǒng)課程設(shè)計(jì)課程論文信息工程學(xué)院數(shù)據(jù)庫課程設(shè)計(jì)論文題 目:網(wǎng)上訂餐系統(tǒng)數(shù)據(jù)庫設(shè)計(jì)學(xué) 號(hào):2010013048專業(yè)班級(jí):信管102班姓 名:張 妙指導(dǎo)老師:英 明完成日期:2012-7-633數(shù)據(jù)庫課程設(shè)計(jì)論文11需求分析31.1總體需求31.2數(shù)據(jù)需求41.3事務(wù)需求41.4數(shù)據(jù)流程圖51.5數(shù)據(jù)字典52數(shù)據(jù)庫結(jié)構(gòu)設(shè)計(jì)62.1 概念設(shè)計(jì)62.1.1 分e-r圖建立62.1.2 全局/整體e-r圖82.2 邏輯設(shè)計(jì)82.2.1 建立關(guān)系模式82.2.2 關(guān)系模式規(guī)范化處理92.2.3 用戶子模式建立103.數(shù)據(jù)庫物理設(shè)計(jì)104數(shù)據(jù)庫實(shí)施與測試104.1 在sql serv
2、er中數(shù)據(jù)庫實(shí)施114.1.1 數(shù)據(jù)庫及數(shù)據(jù)庫對(duì)象建立114.1.2 數(shù)據(jù)入庫144.2 數(shù)據(jù)庫測試144.3 在oracle中數(shù)據(jù)庫實(shí)施204.3.1數(shù)據(jù)庫及數(shù)據(jù)庫對(duì)象建立205總結(jié)206附錄21附錄121附錄225附錄328網(wǎng)上訂餐系統(tǒng)數(shù)據(jù)庫設(shè)計(jì)張妙(信息工程學(xué)院信管10級(jí)2班)摘 要: 近年來,隨著人民的生活水平的不斷提高,餐飲業(yè)在服務(wù)業(yè)中的地位越來越重要,如何從激烈的競爭中脫穎而出,已成為每位餐飲經(jīng)營者思考的問題。隨著21世紀(jì)的進(jìn)步,網(wǎng)絡(luò)迅速崛起,進(jìn)過多年的發(fā)展,網(wǎng)絡(luò)逐步進(jìn)入傳統(tǒng)領(lǐng)域。然而,傳統(tǒng)餐飲企業(yè)的日常運(yùn)作還是靠人工管理,從原材料入庫到客人點(diǎn)餐再到結(jié)賬基本上由人工完成記錄,這樣做
3、不僅耗費(fèi)人力資源而且容易導(dǎo)致記錄丟失或重復(fù)等錯(cuò)誤,造成管理水平低下。將餐飲業(yè)與計(jì)算機(jī)網(wǎng)絡(luò)結(jié)合起來,就形成了網(wǎng)上訂餐系統(tǒng)。顧客能足不出戶就能享受美食,有能力的餐飲企業(yè)提供網(wǎng)上訂餐服務(wù),不僅可以提高服務(wù)質(zhì)量,擴(kuò)大知名度,也極大程度地方便了顧客。經(jīng)過分析,本系統(tǒng)運(yùn)用了microsoft sql server2008和oracle為數(shù)據(jù)庫,系統(tǒng)實(shí)現(xiàn)了菜單維護(hù)、顧客訂單管理、點(diǎn)菜、結(jié)賬、送餐人員查詢、營業(yè)額查詢、消費(fèi)額查詢等功能。關(guān)鍵字:網(wǎng)上訂餐系統(tǒng),sql server,oracle引言1.開發(fā)背景 隨著21世紀(jì)的進(jìn)步,生活節(jié)奏越來越快,傳統(tǒng)的餐飲業(yè)面臨這巨大的挑戰(zhàn)。 網(wǎng)上訂餐主要針對(duì)白領(lǐng)和大學(xué)生這些
4、特定群體,一些白領(lǐng)在中午時(shí)間或者晚上高峰時(shí)間就餐,許多顧客由于高峰擁擠根本沒有時(shí)間享受美味,這樣既可以提前訂餐而不浪費(fèi)午休時(shí)間,也可以和同事加深感情,更可以每天更換各種各樣的菜式,保證每天的工作效率和身體健康。這些問題就產(chǎn)生了快捷訂餐的要求。最方便的莫過于利用計(jì)算機(jī)網(wǎng)絡(luò),將餐飲業(yè)和計(jì)算機(jī)網(wǎng)絡(luò)結(jié)合起來,就形成了網(wǎng)上訂餐系統(tǒng)。2.研究意義隨著人民生活水平的不斷提高,餐飲業(yè)在服務(wù)業(yè)中的地位越來越重要,競爭也越來越激烈。經(jīng)過多年的發(fā)展,對(duì)餐飲企業(yè)的管理以逐步由簡單的人工管理,進(jìn)入規(guī)范的科學(xué)管理階段。在科學(xué)管理階段的具體實(shí)現(xiàn)中,最有效的就是運(yùn)用管理軟件進(jìn)行管理。將計(jì)算機(jī)網(wǎng)絡(luò)應(yīng)用于現(xiàn)代化的餐飲業(yè),解決了傳
5、統(tǒng)的記賬、統(tǒng)計(jì)、結(jié)算等不便之處,操作容易、錯(cuò)誤率低,提高了餐飲業(yè)管理水平。餐飲業(yè)是一種個(gè)性化、多樣化的服務(wù)產(chǎn)業(yè)。隨著網(wǎng)絡(luò)技術(shù)的發(fā)展和普及,形成了方便、快捷的網(wǎng)上訂餐系統(tǒng)。通過網(wǎng)上訂餐,顧客不必親臨現(xiàn)場,便可以吃到計(jì)營養(yǎng)又實(shí)惠的美食,并解決了傳統(tǒng)就餐高峰期排隊(duì)擁擠、信息不能及時(shí)更新的現(xiàn)象,既節(jié)省了時(shí)間,也為廣大用戶提供了更多選擇。3.任務(wù)目標(biāo)本系統(tǒng)主要涉及餐廳的日常運(yùn)營,包括點(diǎn)菜、結(jié)算、銷售統(tǒng)計(jì)、員工管理等功能。(1)后臺(tái)服務(wù):實(shí)現(xiàn)顧客點(diǎn)菜/加菜/退菜(只有未簽單的菜品可以退訂)、預(yù)訂、 簽單、結(jié)賬(打折)功能(所有菜品都簽單后才能結(jié)賬)。(2)后臺(tái)管理:菜品管理、會(huì)員管理,送餐人員管理、留言管
6、理。需要保證對(duì)于以上各種信息的管理能夠同步反應(yīng)到前臺(tái)服務(wù)界面,防止出現(xiàn)點(diǎn)已刪除菜品等情況。(3)銷售統(tǒng)計(jì):統(tǒng)計(jì)某一時(shí)間段的營業(yè)額。1需求分析從分析飯店的基本情況入手,根據(jù)餐飲行業(yè)的特點(diǎn)和實(shí)際情況,充分了解飯店的工作概況,明確用戶各種需求,在此基礎(chǔ)上進(jìn)行系統(tǒng)的可行性分析,了解的管理特點(diǎn)和存在的問題,網(wǎng)上訂餐系統(tǒng)應(yīng)以餐飲業(yè)務(wù)為基礎(chǔ),在此基礎(chǔ)上,進(jìn)行詳細(xì)分析,得出系統(tǒng)功能結(jié)構(gòu)圖。本系統(tǒng)主要是用于后臺(tái)管理,重視營業(yè)數(shù)據(jù)分析等功能,從專業(yè)角度出發(fā),努力為餐飲管理者提供科學(xué)有效地管理模式和數(shù)據(jù)分析功能。1.1總體需求本系統(tǒng)主要涉及餐廳的訂餐功能,包括顧客點(diǎn)菜、送餐員安排、結(jié)算、銷售統(tǒng)計(jì)、留言等功能。預(yù)訂后
7、臺(tái)服務(wù) 點(diǎn)菜/加菜/退菜結(jié)算(打折)菜品管理訂單管理后臺(tái)管理 送餐人員管理留言管理 1.2數(shù)據(jù)需求酒店儲(chǔ)存有會(huì)員信息,包括折扣信息等。菜品信息有菜品編號(hào),名稱,價(jià)格和簡介等。送餐人員信息,包括電話、是否在送餐等。供應(yīng)商信息,包括電話、地址等。原料信息,包括價(jià)格,質(zhì)量等。具體數(shù)據(jù)需求如下:l 點(diǎn)菜階段需要的數(shù)據(jù)有:(1)菜品信息,包括其名稱、價(jià)格、額外要求等。(2)會(huì)員信息,包括會(huì)員編號(hào)、折扣、歷史消費(fèi)總額等。(3)預(yù)訂信息,包括預(yù)訂菜品、菜品數(shù)量、用餐時(shí)間等。l 送餐人員管理需要數(shù)據(jù)有:編號(hào)、電話、是否送餐標(biāo)記等。l 會(huì)員管理需要的數(shù)據(jù)有:會(huì)員編號(hào)、對(duì)應(yīng)折扣等。1.3事務(wù)需求l 數(shù)據(jù)錄入:(1
8、)錄入公告信息(2)錄入菜品信息(3)錄入會(huì)員信息(4)錄入送餐人員信息(5)錄入供應(yīng)商信息(6)錄入原料信息l 數(shù)據(jù)更新/刪除:(1)更新/刪除公告信息(2)更新/刪除菜品信息(3)更新/刪除會(huì)員信息(4)更新/刪除人員信息(5)更新/刪除供應(yīng)商信息(6)更新/刪除原料信息l 數(shù)據(jù)查詢:(1) 查詢菜品信息(2)查詢訂單信息(3)查詢會(huì)員折扣信息(4)查詢送餐人員信息(5)查詢某時(shí)間段的營業(yè)額(6)查詢原料信息1.4數(shù)據(jù)流程圖從最上層的系統(tǒng)組織機(jī)構(gòu)入手,采用自頂向下、逐層分解的方式分析系統(tǒng)。處理功能可分解為若干個(gè)子功能,每個(gè)子功能還可以繼續(xù)分解,直到把系統(tǒng)工作過程表示清楚為止。在處理子功能分
9、解的同時(shí),他們所用的數(shù)據(jù)也逐級(jí)分解,形成若干層次的數(shù)據(jù)流程圖。數(shù)據(jù)流程圖表達(dá)了數(shù)據(jù)和處理之間的關(guān)系。在這個(gè)網(wǎng)上訂餐系統(tǒng)中,數(shù)據(jù)流程圖分為三層:頂層數(shù)據(jù)流程圖、第一層數(shù)據(jù)流程圖、第二層數(shù)據(jù)流程圖;其中,第二層數(shù)據(jù)流程圖又可分為:預(yù)定流程圖、訂單處理流程圖、結(jié)賬流程圖。各個(gè)流程圖反應(yīng)了系統(tǒng)的功能。具體流程圖見附錄1。1.5數(shù)據(jù)字典數(shù)據(jù)字典是系統(tǒng)中各類數(shù)據(jù)描述的集合,是進(jìn)行數(shù)據(jù)收集和數(shù)據(jù)分析所獲得的主要成果。數(shù)據(jù)項(xiàng)通常包括數(shù)據(jù)項(xiàng)、數(shù)據(jù)結(jié)構(gòu)、數(shù)據(jù)流、數(shù)據(jù)存儲(chǔ)和處理過程這5個(gè)部分。具體數(shù)據(jù)字典見附錄2。2數(shù)據(jù)庫結(jié)構(gòu)設(shè)計(jì)主要包括概念設(shè)計(jì)和邏輯設(shè)計(jì)兩個(gè)部分。2.1 概念設(shè)計(jì)這一階段的主要任務(wù)是將需求分析得到
10、的用戶需求抽象為信息結(jié)構(gòu)。2.1.1 分e-r圖建立選擇中層數(shù)據(jù)流程圖作為設(shè)計(jì)分er圖的依據(jù),各個(gè)分er圖如下: (1)供應(yīng)商 (2)原料(3)菜品 (4)顧客 (5)送餐人員 (6)店內(nèi)公告 (7)留言板 (8)折扣規(guī)則2.1.2 全局/整體e-r圖將上述分er圖進(jìn)行合并,并且修改與重構(gòu),得到全局er圖。全局er圖如下:2.2 邏輯設(shè)計(jì)邏輯結(jié)構(gòu)設(shè)計(jì)的任務(wù)是把概念結(jié)構(gòu)設(shè)計(jì)階段設(shè)計(jì)好的基本er圖轉(zhuǎn)換為關(guān)系數(shù)據(jù)庫所支持的關(guān)系模式?;?nf對(duì)關(guān)系模式進(jìn)行優(yōu)化,確定模式內(nèi)容,并且設(shè)計(jì)用戶子模式。2.2.1 建立關(guān)系模式圖轉(zhuǎn)換成關(guān)系模式如下(下劃線的屬性為主碼):供應(yīng)商(供應(yīng)商號(hào)、供應(yīng)商名、電話、地址
11、)原料(原料號(hào)、原料名、價(jià)格、品質(zhì))供應(yīng)(原料號(hào)、供應(yīng)商編號(hào)、供應(yīng)數(shù)量)送餐人員(送餐員號(hào)、姓名、電話、送餐標(biāo)記)配料單(菜品號(hào)、原料號(hào)、使用數(shù)量)菜品(菜品號(hào)、菜品名、價(jià)格、簡介)留言板(留言號(hào)、顧客號(hào)、留言內(nèi)容、回復(fù)內(nèi)容)店內(nèi)公告(公告號(hào)、內(nèi)容)顧客(顧客號(hào)、姓名、電話、地址、歷史消費(fèi)總額、vip等級(jí))折扣規(guī)則(vip等級(jí)、折扣)訂單(訂單號(hào)、顧客號(hào)、用餐時(shí)間)顧客菜單(訂單號(hào)、菜品號(hào)、數(shù)量、要求)送餐單(訂單號(hào)、送餐員號(hào))2.2.2 關(guān)系模式規(guī)范化處理關(guān)系模式優(yōu)化分析如下:(1)供應(yīng)商關(guān)系模式:供應(yīng)商號(hào)供應(yīng)商名供應(yīng)商號(hào)供應(yīng)商電話供應(yīng)商號(hào)供應(yīng)商地址(2)原料關(guān)系模式:原料號(hào)原料名原料號(hào)價(jià)格
12、原料號(hào)品質(zhì)(3)供應(yīng)關(guān)系模式:(原料號(hào),供應(yīng)商號(hào))供應(yīng)數(shù)量(4)菜品關(guān)系模式:菜品號(hào)菜品名菜品號(hào)菜品價(jià)格菜品號(hào)菜品簡介(5)配料單關(guān)系模式:(菜品號(hào)、原料號(hào))使用數(shù)量(6)顧客關(guān)系模式:顧客號(hào)顧客姓名顧客號(hào)電話顧客號(hào)地址 顧客號(hào)歷史消費(fèi)總額顧客號(hào) vip等級(jí)(7)訂單關(guān)系模式:訂單號(hào)顧客號(hào)訂單號(hào)用餐時(shí)間 (8)顧客菜單關(guān)系模式: (訂單號(hào)、菜品號(hào))額外要求(訂單號(hào)、菜品號(hào))數(shù)量(9)留言板關(guān)系模式:(留言號(hào)、顧客號(hào))留言內(nèi)容(留言號(hào)、顧客號(hào))回復(fù)內(nèi)容(10)送餐員關(guān)系模式:送餐員號(hào)送餐員姓名送餐員號(hào)送餐員電話送餐員號(hào)送餐標(biāo)記(11)店內(nèi)公告關(guān)系模式:公告號(hào)內(nèi)容(12)折扣規(guī)則關(guān)系模式:vip等
13、級(jí)折扣經(jīng)過以上分析,上述關(guān)系模式不存在部分函數(shù)依賴和傳遞函數(shù)依賴,已達(dá)到3nf要求。2.2.3 用戶子模式建立以下是建立的用戶子模式,其功能和運(yùn)用如描述:名稱描述f_consumer1供顧客查詢菜品及其簡介f_consumer2供顧客查詢菜品及其所用的主原料 f_changer1管理員查詢各個(gè)顧客點(diǎn)菜數(shù)量 f_changger2管理員查詢顧客的消費(fèi)額3.數(shù)據(jù)庫物理設(shè)計(jì)數(shù)據(jù)庫在物理設(shè)備上的存儲(chǔ)結(jié)構(gòu)與存取方法就是數(shù)據(jù)庫的物理結(jié)構(gòu),它依賴于選定的數(shù)據(jù)庫管理系統(tǒng)。為一個(gè)給定的邏輯數(shù)據(jù)模型選取一個(gè)最合適的應(yīng)用環(huán)境的物理結(jié)構(gòu)的過程,就是數(shù)據(jù)庫的物理設(shè)計(jì)。這一階段主要的任務(wù)是確定數(shù)據(jù)庫的物理結(jié)構(gòu),并不斷的進(jìn)
14、行優(yōu)化處理,主要建立索引。以下是建立的索引,其功能和運(yùn)用如描述:名字描述selete_on_dishname建立在菜品名上的索引allow_der建立在送餐員名字和送餐標(biāo)記上的索引4數(shù)據(jù)庫實(shí)施與測試主要包括數(shù)據(jù)庫實(shí)施和測試兩個(gè)部分。4.1 在sql server中數(shù)據(jù)庫實(shí)施4.1.1 數(shù)據(jù)庫及數(shù)據(jù)庫對(duì)象建立建立數(shù)據(jù)庫,命名為order_menu_online,在其中建立數(shù)據(jù)庫對(duì)象,主要包括:基本表、視圖、索引、觸發(fā)器以及存儲(chǔ)過程。 (1)基本表 create table supplier( sno varchar(10)primary key, sname varchar(20)not nul
15、l, sph varchar(15)not null, sadd varchar(20)create table good( gno varchar(10) primary key, gname varchar(20) not null, gprice float, gquatity varchar(10)create table supply( gno varchar(10), sno varchar(10), snum int, sdate date, primary key(gno,sno), foreign key(sno)references supplier(sno), forei
16、gn key(gno)references good(gno)create table dish( dno varchar(10) primary key, dname varchar(20) not null, dprice float, dintro varchar(100)create table gford( dno varchar(10), gno varchar(10), usenum float, primary key(dno,gno), foreign key(dno)references dish(dno), foreign key(dno)references dish(
17、dno)create table deliverper( deliverno varchar(10) primary key, delivername varchar(20) not null, deliverph char(15) not null, isdeliver int)create table discount_ruler( vgrade int primary key, discount float not null unique )create table consumer( cno varchar(10) primary key, cname varchar(20) not
18、null, cph varchar(15)not null, cadd varchar(20) not null, cmon float, vgrade int, foreign key(vgrade)references discount_ruler(vgrade)create table ordermenu( orderno varchar(10) primary key, cno varchar(10) not null, eattime datetime not null, foreign key(cno) references consumer(cno)create table di
19、shmenu( orderno varchar(10), dno varchar(10), dishnum int not null, exquest varchar(50), primary key(orderno,dno), foreign key(orderno)references ordermenu(orderno), foreign key(dno)references dish(dno)create table delivermenu( orderno varchar(10), deliverno varchar(10), primary key(orderno,delivern
20、o), foreign key(orderno)references ordermenu(orderno), foreign key(deliverno)references deliverper(deliverno)create table notice( nno varchar(10) primary key, ncontent varchar(100) not null)create table board( bno varchar(10), cno varchar(10), content varchar(100) not null, replycontent varchar(100)
21、, primary key(bno,cno), foreign key (cno) references consumer(cno)(2) 視圖:create view f_consumer1(菜名,所用原料)asselect dname,gnamefrom dish,good,gfordwhere dish.dno=gford.dno and good.gno=gford.gno;create view f_consumer2(菜名,簡介)asselect dname,dintrofrom dishcreate view f_changer1(顧客名,總點(diǎn)菜數(shù))asselect cname,
22、count(dno)from consumer,ordermenu,dishmenuwhere consumer.cno=ordermenu.cno and ordermenu.orderno=dishmenu.ordernogroup by consumer.cname;create view f_changer2(顧客名,本次消費(fèi)額)asselect cname,sum(dprice*dishnum)from consumer,dish,ordermenu,dishmenuwhere consumer.cno=ordermenu.cno and dish.dno=dishmenu.dno
23、and dishmenu.orderno=ordermenu.ordernogroup by consumer.cname;(3)索引create unique index selete_on_dishname on dish(dname)create unique index allow_der on deliverper(delivername,isdeliver)4.1.2 數(shù)據(jù)入庫對(duì)各個(gè)主要數(shù)據(jù)表要錄入20條以上的記錄,方法可用excel批量導(dǎo)入,也可以逐條錄入。4.2 數(shù)據(jù)庫測試(1) 存儲(chǔ)過程測試create procedure 查詢預(yù)訂consumerno varchar(10)
24、,delivername varchar(20) output,deliverph varchar(15) output as beginif exists(select* from ordermenu where cno=consumerno)beginprint 已預(yù)訂select delivername=delivername,deliverph=deliverphfrom delivermenu ,deliverperwhere delivermenu.deliverno=deliverper.delivernoprint 送餐員姓名為:+delivernameprint 送餐員電話為
25、:+deliverphendelse print 未預(yù)定enddeclare name varchar(20),ph varchar(15)exec 查詢預(yù)訂 022,name output,ph outputdeclare name varchar(20),ph varchar(15)exec 查詢預(yù)訂 008,name output,ph outputcreate procedure 預(yù)訂 orderno varchar(10), cname varchar(20), eattime datetime as declare cno varchar(100) if exists(select
26、 * from consumer where cname=cname) begin print(歡迎您再次光臨本店,請預(yù)訂) select cno=cno from consumer where cname=cname insert into ordermenu values(orderno,cno,eattime) end else print(歡迎光臨本店,請先注冊)exec 預(yù)訂 022,楊小綠,2012-6-30 12:00 exec 預(yù)訂 022,呂葉馨,2012-6-30 12:00create procedure 點(diǎn)菜 orderno varchar(10), dname var
27、char(10), dishnum int, exquest varchar(50) as declare no varchar(10) select no=dno from dish where dname=dname if exists (select * from ordermenu where orderno=orderno) insert into dishmenu values(orderno,no,dishnum,exquest) else print(沒有預(yù)訂信息,請預(yù)訂后再點(diǎn)餐)exec 點(diǎn)菜 023,南芥草莓餅,1,exec 點(diǎn)菜 022,九轉(zhuǎn)大腸,1,exec 點(diǎn)菜 02
28、2,滑藕片小炒,2,exec 點(diǎn)菜 022,白斬雞,1,記得送佐料exec 點(diǎn)菜 022,冬瓜盅,1,exec 點(diǎn)菜 022,小黃魚炒年糕,1, create procedure 修改菜單 orderno varchar(10), dno varchar(10) as delete from dishmenu where orderno=orderno and dno=dnoexec 修改菜單 022,d4輸入顧客號(hào),計(jì)算本次應(yīng)付金額create procedure 實(shí)際消費(fèi)金額 cno varchar(10), expend float output as select expend=本次消
29、費(fèi)額 from f_changer2,consumer where consumer.cname=f_changer2.顧客名 and consumer.cno=cnodeclare consumerno varchar(10)=002,expendnum float exec 實(shí)際消費(fèi)金額 consumerno,expendnum output select cname,expendnum from consumer where consumer.cno=consumernocreate procedure 開消費(fèi)單 cno varchar(10), totalpay float as de
30、clare cname varchar(20),actualpay float,gettime date select cname=cname from consumer where cno=cno-根據(jù)顧客號(hào)找出顧客姓名 select actualpay=(本次消費(fèi)額*(discount*0.1)-計(jì)算顧客打折后應(yīng)付實(shí)際金額 from f_changer2,consumer,discount_ruler where f_changer2.顧客名=consumer.cname and consumer.cno=cno and consumer.vgrade=discount_ruler.vgr
31、ade select gettime=eattime-獲取顧客要求送飯時(shí)間,作為開發(fā)票的時(shí)間 from ordermenu where ordermenu.cno=cno print用戶名:+ +cname print實(shí)付:+str(totalpay,10,2) print應(yīng)付:+str(actualpay,10,2) print找零:+str(totalpay-actualpay,10,2) print時(shí)間:+ +cast(gettime as varchar(10) print謝謝您的光臨,歡迎下次再來! declare consumerno varchar(10)=002,consume
32、rpay float=200 exec 開消費(fèi)單 consumerno ,consumerpaycreate proc 查詢營業(yè)額begintime datetime,endtime datetime,sum_of_turnover float outputasselect sum_of_turnover=sum(本次消費(fèi)額*(discount*0.1)from f_changer2,consumer,ordermenu,discount_rulerwhere eattime=begintime and eattimeendtime and f_changer2.顧客名=consumer.cn
33、ameand consumer.cno=ordermenu.cnoand consumer.vgrade=discount_ruler.vgradeprint 從時(shí)間:+ cast( begintime as varchar(20)+ 到時(shí)間:+ cast( endtime as varchar(20)+ 的營業(yè)總額為:+str(sum_of_turnover, 10, 2)declare sum float exec 查詢營業(yè)額 2012-6-25,2012-7-1,sum outputselect sumcreate procedure 查詢顧客訂餐 time datetime as de
34、clare cname varchar(20),caddress varchar(50),cph varchar(10) declare c1 cursor for select cname,cadd,cph from consumer,ordermenu where consumer.cno=ordermenu.cno and eattime=time print cast(time as varchar(10)+訂餐的顧客有: open c1 fetch next from c1 into cname,caddress,cph while(fetch_status=0) begin pri
35、nt顧客姓名:+ +cname print顧客地址:+ +caddress print顧客電話:+ +cph fetch next from c1 into cname,caddress,cph end close c1 deallocate c1(1) 觸發(fā)器測試create trigger trig_upgrade_of_vipgrade on consumerafter update asdeclare no varchar(20),totalexpend float,grade int select no = cno, totalexpend=cmon, grade = vgradef
36、rom insertedif(totalexpend = 100 and totalexpend = 200 and totalexpend = 300 and totalexpend = 400 and totalexpend= 500 and totalexpend = 600 and totalexpend = 700 and totalexpend = 800 and totalexpend = 900 and totalexpend 1000)set grade = 9else set grade=10update consumer set vgrade = grade where
37、cno = noupdate consumer set cmon=200 where cname=玄冰update consumer set cmon=228 where cname=呂葉馨4.3 在oracle中數(shù)據(jù)庫實(shí)施4.3.1數(shù)據(jù)庫及數(shù)據(jù)庫對(duì)象建立 見附錄35總結(jié)本次數(shù)據(jù)庫課程設(shè)計(jì)為期15天。在這15天中雖然要兼顧考試和實(shí)習(xí),顯得忙碌,但在整個(gè)實(shí)習(xí)過程中,感覺挺有收獲。雖然上課很認(rèn)真的聽講,平時(shí)實(shí)驗(yàn)課內(nèi)容覺得簡單,但在這次實(shí)習(xí)中還是遇到不少問題。例如,從數(shù)據(jù)流程圖中抽取數(shù)據(jù)項(xiàng)和數(shù)據(jù)處理時(shí),覺得有點(diǎn)亂;剛開始er圖畫的不到位,導(dǎo)致關(guān)系模式反復(fù)返工。這次實(shí)習(xí)讓我初步了解了了解如何開發(fā)數(shù)據(jù)庫
38、,為以后的職業(yè)生涯肯定會(huì)有幫助。此外,在這次實(shí)習(xí)中,我了解并比較熟悉了如何運(yùn)用sql server2008 數(shù)據(jù)庫開發(fā)數(shù)據(jù)庫系統(tǒng),并且初步接觸了oracle ,運(yùn)用oracle 進(jìn)行基本的操作,雖然在將數(shù)據(jù)庫移植到oracle中時(shí),困難重重,但我一一解決,讓我感覺收獲很大。在此還要感謝輔導(dǎo)老師對(duì)我熱情的指導(dǎo),感謝許多同學(xué)的幫助,是他們在程序調(diào)試中幫我改正錯(cuò)誤,提出合理化的建議,增強(qiáng)程序的功能,借閱各種書籍,在你們的幫助下,我及時(shí)糾正自己的錯(cuò)誤,修改方案,才完成了這次實(shí)習(xí),否則這三周就白白浪費(fèi)了。6附錄附錄1 數(shù)據(jù)流程圖(1) 頂層數(shù)據(jù)流程圖(2) 第一層數(shù)據(jù)流程圖:(3) 第二層數(shù)據(jù)流程圖預(yù)訂
39、流程圖訂單處理流程圖結(jié)賬流程圖附錄2 (1) 數(shù)據(jù)項(xiàng):數(shù)據(jù)項(xiàng)編號(hào) 數(shù)據(jù)項(xiàng)名數(shù)據(jù)項(xiàng)含義數(shù)據(jù)類型長度di-1dishno菜品編號(hào)char5di-2dishname菜品的名稱char10di-3dishprice菜品的價(jià)格floatdi-4dishintro菜品的介紹及原料nvarchar100di-5cno顧客編號(hào)char5di-6cname顧客姓名char10di-7cad顧客地址nvarchar20di-8cmon顧客歷史消費(fèi)總額float6di-9cph顧客電話char15di-10vgrade顧客vip等級(jí)int3di-11oderno訂單編號(hào)char5di-12time用餐時(shí)間char1
40、0di-13exrequest顧客的額外要求nvarchar50di-14sno供應(yīng)商編號(hào)char5di-15sname供應(yīng)商名稱char10di-16sph供應(yīng)商電話char15di-17saddress供應(yīng)商地址nvarchar20di-18goodno原料的編號(hào)char5di-19goodname原料的名稱char10di-20goodprice原料的價(jià)格floatdi-21qutity原料的品質(zhì)char10di-22boardno留言編號(hào)char5di-23boardcontent留言內(nèi)容nvarchar200di-24boardreply回復(fù)內(nèi)容nvarchar200di-25del
41、ierno送餐員編號(hào)char5di-26delivername送餐員名字char10di-27deliverph送餐員電話char15di-28noticeno店內(nèi)公告編號(hào)char5di-29noticecontent店內(nèi)公告內(nèi)容char100di-30discount折扣float(2)數(shù)據(jù)結(jié)構(gòu):數(shù)據(jù)結(jié)構(gòu)編號(hào)數(shù)據(jù)結(jié)構(gòu)名數(shù)據(jù)結(jié)構(gòu)含義組成dt-1dishes菜品dishno、dishname、dishprice、dishintrodt-2orderform訂單oderno、cno、timedt-3consumer顧客cno、cname、cad、cph、cmon、vgradedt-4supplie
42、r供應(yīng)商sno、sname、sph、saddressdt-5deliverper送餐人員delierno、deliername、delierph、isdeliverdt-6good原料goodno、goodname、goodprice、qualitydt-7buyform采購單sno、goodno、numdt-8board留言板boardno、boardcontent、boardreplydt-9notice店內(nèi)公告noticeno、noticecontentdt-10discount折扣規(guī)則vgrade、disnumdt-11dform配送單oderno、delivernodt-12gfor
43、d配料單orderno、goodno、numdt-13dishmenu顧客菜單orderno、dishno、dishnum、quest(3) 數(shù)據(jù)處理:處理編號(hào)處理名稱簡述輸入數(shù)據(jù)流處理輸出數(shù)據(jù)流處理頻率1盤存采購采購人員采購原料原料清單根據(jù)清單確認(rèn)采購原料訂貨單30次/ 月2退貨檢驗(yàn)原料不合格退貨不合格單確定退貨退貨單2次/月3預(yù)定菜單顧客下訂單顧客預(yù)定的菜品信息確認(rèn)訂單菜單30000次/月4菜單處理分配送餐人員菜單分配送餐人員配送單27000次/月5結(jié)賬統(tǒng)計(jì)顧客消費(fèi)總額菜單處理賬單消費(fèi)單27000次/月(4)數(shù)據(jù)存儲(chǔ):數(shù)據(jù)存儲(chǔ)編號(hào)數(shù)據(jù)存儲(chǔ)名稱簡述數(shù)據(jù)存儲(chǔ)組成1菜品單改變菜品單菜品的所有信息
44、2顧客信息顧客信息更新顧客的基本信息3送餐員信息判斷送餐員忙閑送餐員的基本信息和送餐標(biāo)記4訂單存儲(chǔ)存儲(chǔ)用戶訂單訂餐的各項(xiàng)要求5配送單顧客的消費(fèi)信息訂單號(hào)+送餐員號(hào)(5)數(shù)據(jù)流:數(shù)據(jù)流編號(hào)數(shù)據(jù)流名稱簡述數(shù)據(jù)流來源數(shù)據(jù)流去向數(shù)據(jù)流組成數(shù)據(jù)流量高峰流量1采購單采購人員采購原料的單據(jù)供應(yīng)商采購人員原料號(hào)+供應(yīng)商號(hào)+進(jìn)貨量30次/月60次/月3退貨單采購人員發(fā)出的退貨單采購員供應(yīng)商原料號(hào)+供應(yīng)商號(hào)+退貨量2次/月5次/月4顧客訂單顧客給酒店的訂單顧客酒店管理員訂單號(hào)+菜品號(hào)+用餐時(shí)間+要求30000次/月50000次/月5配送單酒店安排送餐并返回給顧客的消費(fèi)單酒店顧客訂單號(hào)+送餐員27000次/月460
45、00次/月6退訂單顧客給酒店的退訂單顧客酒店訂單號(hào)+菜品編號(hào)+用餐日期300次/月400次/月附錄3 (1)基本表:create table supplier( sno varchar(10)primary key, sname varchar(20)not null, sph varchar(15)not null, sadd varchar(20)create table good( gno varchar(10) primary key, gname varchar(20) not null, gprice number, gquatity varchar(10)create table
46、 supply( gno varchar(10), sno varchar(10), snum number, sdate date, primary key(gno,sno), foreign key(sno)references supplier(sno), foreign key(gno)references good(gno)create table dish( dno varchar(10) primary key, dname varchar(20) not null, dprice number, dintro varchar(100)create table gford( dn
47、o varchar(10), gno varchar(10), usenum number, primary key(dno,gno), foreign key(dno)references dish(dno), foreign key(dno)references dish(dno)create table deliverper( deliverno varchar(10) primary key, delivername varchar(20) not null, deliverph char(15) not null, isdeliver number check(isdeliver i
48、n(0,1)create table discount_ruler( vgrade int primary key, discount float not null unique )create table consumer( cno varchar(10) primary key, cname varchar(20) not null, cph varchar(15)not null, cadd varchar(20) not null, cmon number, vgrade number, foreign key(vgrade)references discount_ruler(vgrade)create table ordermenu( orderno varchar(10) primary key, cno varchar(10) not null, eattime datetime not null, foreign key(cno) references consumer(cno)create table dishmenu( orderno varchar(10), dno varchar(10), dishnum number not null, exquest varchar(50),
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年軍隊(duì)文職人員招聘之軍隊(duì)文職管理學(xué)考前沖刺模擬試卷A卷含答案
- 2025年軍隊(duì)文職人員招聘之軍隊(duì)文職公共科目題庫檢測試卷B卷附答案
- 2025年消防設(shè)施操作員之消防設(shè)備高級(jí)技能能力提升試卷B卷附答案
- 采購分包資源配置合同(2篇)
- 2023年全國碩士研究生考試《管理類聯(lián)考綜合能力》試題真題及答案
- 2025年黨史競賽知識(shí)題庫70題及答案
- 會(huì)計(jì)學(xué)成本會(huì)計(jì)模擬試題集
- 各行業(yè)各年度數(shù)據(jù)對(duì)比表格
- 泰坦尼克號(hào)的文化價(jià)值和社會(huì)反思:高中語文教學(xué)教案
- 經(jīng)濟(jì)學(xué)微觀經(jīng)濟(jì)學(xué)知識(shí)點(diǎn)歸納與解析
- 07SG111-1 建筑結(jié)構(gòu)加固施工圖設(shè)計(jì)表示方法
- 屋頂分布式光伏發(fā)電EPC項(xiàng)目 投標(biāo)方案(技術(shù)方案)
- 網(wǎng)約車停運(yùn)損失費(fèi)起訴狀模板
- 中國急性缺血性卒中診治指南(2023)解讀
- A型肉毒素治療知情同意書 注射知情同意書
- 混凝土采購項(xiàng)目整體供貨方案
- 血液透析導(dǎo)管溶栓及護(hù)理
- 公司外聘人員管理制度
- 慢病聯(lián)合用藥病
- 蘭州拉面-模板參考
- 武漢市2024屆高中畢業(yè)生二月調(diào)研考試(二調(diào))英語試卷(含答案)
評(píng)論
0/150
提交評(píng)論