文档详情

餐饮管理系统的数据库设计

suij****uang
实名认证
店铺
DOCX
423.48KB
约28页
文档ID:139681875
餐饮管理系统的数据库设计_第1页
1/28

— 线装 ——信息管理学课程论文评分标准分值得分完成数据库系统设计工作任务20分论文文章结构安排合理,写作规范,引注正确10分论文逻辑条理清晰,论证有力•理论阐述全面,能够联系实际分析问题, 解决问题10分需求分析:问题陈述清楚、需完成的功能描写准确,ER模型图正确20分数据库逻辑设计:把ER模型图转换为关系表描述每一个基本表关系 要求所有关系达到BCNF范式定义视图、索引、主关键字、权限20分数据库物理设计:定义数据物理文件及管理10分开发与编码:编写程序、调试并进行测试.10分成绩广东商学院答题纸(格式二)课程 数据库系统设计 2010 - 2011学年第2学期成绩 评阅人请选取数据库系统设计课程设计相关主题,在某个RDBMS软件基础上利用合适的应用系统开发工具 为某个部门或者单位开发一个数据库系统要求给出数据库设计概念设计、逻辑设计、物理设计、开发 与编码、测试各个阶段的详细设计:写出系统的主要功能和使用说明;提交运行的系统完成的主要功 能包括录入、修改、查询、输出的信息管理功能基本要求:(1)完成问题陈述中所提到的所有需 求功能;(2)要求撰写不少于3000个文字的文档;(3)文档中至少要包括:ER模型图、系统 功能图、数据字典、表关系的详细说明。

4 )用户手册,描述软件系统所具有的功能及基本的使 用方法文档格式参考毕业论文要求,章节包括:(1)概述:包括项目背景、编写目的、软件定义、 开发环境等内容2)需求分析:问题陈述、需完成的功能,画出ER模型图;(3)数据库逻辑设 计:把ER模型图转换为关系表•描述每一个基本表关系•要求所有关系达到BCNF范式定义视图、 定义索引、主关键字、定义权限4)数据库物理设计:定义数据物理文件及管理5)开发与 编码:编写程序、调试并进行测试.(6)结束语:写出完成本课程设计的心得,领会数据库理论与软 件开发实践的关系有哪些收获软件还需要哪些改进7)参考文献严禁剽窃、抄袭等作弊行为!全文抄袭,或未按时交卷,或与课程内容毫不相关按不及格处理餐饮管理系统的数据库设计内容摘要数据库设计在如今信息化时代是一个重要的管理项目本餐饮管理系 统的数据库设计主要是针对中小型的餐饮店,通过对餐饮店的业务过程分 析,进行业务流程图、数据流程图、E—R图及其规范化,进而数据库逻辑 设计、物理设计等方面的设计,创建一个方便易用、简洁友好的数据库系 统.通过数据库对各方面信息进行管理能提高参与管理的效率,增强企业的 竞争力,同时也是企业的科学化、正规化管理的要求。

关键词:数据库设计E-R图规范化餐饮管理AbstractDatabase design in information era now is an important management project This restaurant management system database design is mainly aimed at small and medium of restaurants o Through the analysis of the business process of restaurants, conduct business flow chart, data flow chart, E—Rchart and standardization, and database logical design, physical design, and other aspects of the design, to create a convenient and easy to use, simple friendly database system o Through the database to manage the information can enhance the efficiency of restaurant management, enhance the competitiveness of the enterprises, which is also the requirements of scientific enterprise, standardization management .Key words: Database design E—R chart standardization cateringmanagement1概述1o 1项目背景餐饮业是指以商业赢利为目的的餐饮服务机构。

随着经济的发展,餐饮业已呈现出高速 发展的状态但是,在快速发展的同时,餐饮业在日常经营管理中大都是以人为主体的, 需要很多的人力、物力、财力,且效率不是很高,在系统运营时也可能产生人为的失误 传统的餐饮管理工作既繁琐也不利于分析企业的经营状况,在提供决策信息方面也难以适 应现代化经营管理的要求,因此制约了整个餐饮业的规模化发展和整体服务水平的提升1.2编写目的在餐饮管理中引入数据库这一信息管理技术,具有人工管理所无法比拟的优点例如 统计结账快速、安全保密性好、可靠性高、存储量大、寿命长、成本低等通过对餐饮店 管理信息方面进行数据库建立,能够极大地提高餐饮管理的效率,增强企业的竞争力,同 时也是企业的科学化、正规化管理,与世界接轨的重要条件[门1o 3软件定义在本数据库的开发中,主要涉及的软件如下:Microsoft office visio 2003Sybase powerdesignerl5.1Microsoft office word 2003Microsoft SQL Sever 20001o 4开发环境操作系统:Microsoft Windows XP硬件组成:Genuine Intel(R) CPU T2300 @ 1。

66 GHz 166 GHz0.99 GB的内存2需求分析2.1问题陈述在餐饮店中,当顾客进来时需要根据顾客人数安排餐桌,确定餐桌后,为其安排点菜, 得到顾客菜单后送交厨房并让其烹饪相应的菜式,在用餐期间顾客可变更菜单,而厨房 就需要及时核对顾客菜单,以做出改变最后对顾客菜单进行结算,得到账单送给顾客结 账,并将发票送至顾客和财务部门处另外,对于操作用户有一定的管理,并对用户权限 有一定的设置:用户权限如下:服务员:直接将顾客的菜单等信息输入系统,并送到厨房和菜单结算处,并反馈信息 给顾客.厨师:直接查看菜单信息,要随时更新菜单.结算员:根据菜单结算消费金额,并将发票给顾客和财务部门财务员:根据发票入账,并可审查财务报表2.2功能描述信息在顾客、厨房、财务部门和餐饮管理系统直接流动,不同的对象之间的输入输 出所需的信息不同具体如图2所示:顾客发票.r 、菜单一》餐饮管理系统 发票 户-烹饪.菜单*厨房财务部门图2餐饮管理系统顶级数据流程图实现信息流向的细分化,在安排餐桌、点菜上进行分解,顾客点菜需要为其提供菜单,之后的顾客菜单再进行结算得到账单,顾客结账后将发票送至财务部门.具体如图3所进一步细化各项数据,在安排餐桌中需要有餐桌类型和餐桌编号的信息;在点菜中 需要有菜式及其数量的信息;在结算中需要菜式单价和消费数量的信息•这些流程中对数 据所要求内容更细分,具体如图4所示:r 、、>确定餐桌编号■. .餐桌编号选择菜式菜单信息确定菜单菜单餐桌类型匹配餐桌类型菜式菜单信息菜式U餐桌人数、登记餐桌信息菜式及数量消费数量|消费数量'菜式及数量顾客人数顾客财务部门更改菜单增加菜式• >顾客菜单jL确定菜单记账厨房菜式单价单价账单单价及数量**——发票、计算总价结帐消费数量 I 丿图4餐饮管理系统三级数据流程图2。

3餐饮管理系统ER模型图参照功能描述的内容,画出初步的E-R图,具体的实体及联系如下:2.3.1实体:顾客菜单信息(餐桌编号,顾客编号,菜式编号,菜式名称,消费数量,菜式价格, 菜式详情)顾客餐桌信息(顾客人数,消费时间,餐桌编号,餐桌位置,餐桌状态,餐桌类型) 账单(账单编号,消费总额,顾客编号)厨房(厨师编号,厨师姓名)财务部门(职员编号,职员姓名,审查日期)2.3.2实体之间的联系:顾客菜单信息-顾客餐桌信息:点菜 顾客菜单信息一厨房:烹饪(烹饪时间) 顾客菜单信息-账单:结账(经手人) 财务部门一账单:财务管理(填表日期) 具体的E-R图如图5所示:菜式名称菜式编号(顾客编号餐桌类型餐桌状态餐桌位置■ 丿消费数量菜式价格L I—1 —点菜___1_一_一顾客菜单信息’I餐桌编号 顾客餐桌信息J消费时间■式详情顾客人数餐桌编号经手人V J结账烹饪烹饪时间账单编号、—人、消费总额-r顾客编号厨房厨师编号 -A J厨师姓名账单财务管理财务部门f 、职员编号 入 丿职员姓名1 IV 7审查日期 k Jf 、填表日期图5餐饮管理系统E-R图3数据库逻辑设计31 E—R图转换为关系表关系模式可划分为:顾客(顾客编号,顾客人数,餐桌编号,菜式编号,消费数量)菜单(菜式编号,菜式名称,菜式价格,菜式详情)餐桌(餐桌编号,餐桌位置,餐桌状态,餐桌类型)账单(账单编号,消费总额,顾客编号,经手人)厨房(厨师编号,厨师姓名,烹饪时间)财务部门(职员编号,职员姓名,审查日期,填表日期)3。

2基本表关系描述顾客(顾客编号,顾客人数,餐桌编号,菜式编号,消费数量)在该模式中,没有任何属性对主码“顾客编号”部分函数依赖或传递函数依赖⑵,所 以该模式属于3NF,同时,“顾客编号”为唯一主码,所以该模式属于BCNF.菜单(菜式编号,菜式名称,菜式价格)在该模式中,没有任何属性对主码“菜式编号”部分函数依赖或传递函数依赖,所 以该模式属于3NF,同时,“菜式编号”为唯一主码,所以该模式属于BCNF.餐桌(餐桌编号,餐桌位置,餐桌状态,餐桌类型)在该模式中,没有任何属性对主码“餐桌编号”部分函数依赖或传递函数依赖,所 以该模式属于3NF,同时,“餐桌编号”为唯一主码,所以该模式属于BCNF账单(账单编号,消费总额,顾客编号,经手人)在该模式中,没有任何属性对主码“账单编号”部分函数依赖或传递函数依赖,所 以该模式属于3NF,同时,“账单编号”为唯一主码,所以该模式属于BCNF厨房(厨师编号,厨师姓名,烹饪时间)在该模式中,没有任何属性对主码“厨师编号"部分函数依赖或传递函数依赖,所以该 模式属于3NF,同时,“厨师编号”为唯一主码,所以该模式属于BCNF财务部门(职员编号,职员姓名,审查日期,填表日期)在该模式中,没有任何属性对主码“职员编号”部分函数依赖或传递函数依赖,所 以该模式属于3NF,同时,“职员编号”为唯一主码,所以该模式属于BCNF。

3.3定义视图、定义索引、主关键字、定义权限3.3.1定义视图(1)视图厨房表的代码预览if exists (select 1from whereandsysobjectsid = object_id('KitchenList') type = 'V')drop view KitchenListgo/ * ================== /* View: KitchenList /*==================: create view KitchenList as select厨师姓名,烹饪时间 from厨房*/*/go(2)视图菜单表的代码预览if exists ( select 1from where andsysobjectsid = object_id ('FoodList') type = 'V')drop view FoodList go/ * ========================== /* View: FoodList/ * =========================== create view FoodList asselect菜式名称,菜式价格,菜式详情 from菜单*/*/*/if exists ( select 1from where andgo(3)视图财务部门表的代码预览sysobjectsid = object_id ('FinanceDepartmenList') type = 'V')drop view FinanceDepartmenList go/ * ============================================================== *// * View: FinanceDepartmenList */ create view FinanceDepartmenList asselect职员姓名,审查日期,填表日期from财务部门go(4) 视图账单表的代码预览if exists (select 1from sysobjectswhere id = object_id ('BillList')and type = 'V')drop view BillListgo/ * ============================================================== *//* View: BillList *//*==============================================================*/create view BillList asselect消费总额,顾客编号,经手人from账单go(5) 视图顾客表的代码预览if exists (select 1from sysobjectswhere id = object_id ('GuestList')and type = 'V')drop view GuestListgo/*============================================================== *//* View: GuestList *//*============================================================== */create view GuestList asselect顾客编号,餐桌编号,菜式编号,消费数量 from顾客go(6)视图餐桌表的代码预览if exists (select 1from sysobjectswhere id = object_id ('TableList')and type = 'V')drop view TableListgo/*============================================================== *//* View: TableList 卡 //*==============================================================*/ create view TableList asselect餐桌编号,餐桌状态from餐桌go3.3.2定义索引(1) 表格厨房的索引的代码预览/*============================================================== */ /* Index: CookID * //*==============================================================*/ create index CookID on Kitchen ()Go(2) 表格菜单的索引的代码预览/*==============================================================*/ /* Index: FoodID *//*==============================================================*/ create index FoodID on Food ()Go(3) 表格财务部门的索引的代码预览/*============================================================== */ / * Index: WorkerID *//*==============================================================*/ create index WorkerID on FinanceDepartment ()Go(4) 表格账单的索引的代码预览/*==============================================================*/ /* Index: BilllD *//*============================================================== */ create index BilllD on Bill ()Go(5) 表格顾客的索引的代码预览/*============================================================== *//* Index: GuestID *// * ============================================================== * /create index GuestID on Guest ()Go(6) 表格餐桌的索引的代码预览/ * ============================================================== *// * Index: TableID *//*============================================================== */create index TableID on Table ()Go3。

33主关键字顾客:顾客编号菜单:菜式编号餐桌:餐桌编号账单:账单编号厨房:厨师编号财务部门:职员编号34定义权限用户厨师权限,如图6所示:图8用户结算员权限用户财务员权限,如图9所示:Inl申 Us«r Prop er±i es 一 财务员 (F±hulc eOffi cer )G-eneral | Frivilesee Permi ssions | Motes | Pre^i ew雪丨罄「X〕鞘「thNameSelectFl eh.嗾单....顾客餐卓—— :―--f- :―-=t"厂None| |\Table ^View ^Procedure /Permissian state5 User state shown above group slate]GrarH3]Revoke匚口||_」四门jGrant with grant optionRevoke with cascade帮助I图9用户财务员权限4数据库物理设计4.1数据库物理模型餐饮管理系统的数据库物理模型,如图10所示:餐桌编号 餐桌位置 餐桌状态 餐桌类型餐桌intchar(10)char(10) char(10)菜式编号 菜式名称 菜式价格 菜式详情菜单int varchar(50) decimal(9) varchar(200)顾客编号int厨师编号int餐桌编号int账单编号int菜式编号int顾客人数int消费数量int顾客账单账单编号int顾客编号int职员编号int消费总额decimal(9)经手人varchar(50)财务部门表 职员姓名 审查日期 填表日期目财务部门厨房厨师编号int厨师姓名 varchar(50) 烹饪时间datetime职员编号 职员姓名 审查日期 填表日期财务部门int varchar(50) datetime datetime顾客表顾客编号 餐桌编号 菜式编号 消费数量厨房表厨师姓名 烹饪时间厨房菜单表菜式名称菜式价格,菜式详情 菜单餐桌表餐桌编号餐桌状态E3餐桌消费总额 顾客编号图10餐饮管理系统数据库物理模型4.2表格清单表1餐饮管理系统表格清单名称代码厨房Kitchen菜单Food财务部门FnanceDepartment账单Bill顾客Guest餐桌Table4.3表格列清单表2餐饮管理系统表格列清单名称代码顾客编号GuestID厨师编号CookID餐桌编号TablelD账单编号BilllD菜式编号FoodID顾客人数GuestNum消费数量FoodSum菜式编号FoodID菜式名称FoodName菜式价格FoodPrice菜式详情FoodDescription餐桌编号TableID餐桌位置TableLocation餐桌状态TableStatus餐桌类型TableType账单编号BillID顾客编号GuestID职员编号WorkerID消费总额FoodAllPrice经手人PersonHanding厨师编号CookID厨师姓名CookName烹饪时间CookingTime职员编号WorkerID职员姓名WorkerName审查日期ReviewDate填表日期FillingDate4.4表格键清单表3餐饮管理系统表格键清单名称代码表格Identifier」Identifier 1顾客Identifier」Identifier 1菜单Identifier」Identifier 1餐桌Identifier 1Identifier 1账单Identifier 1Identifier 1厨房Identifier 1Identifier 1财务部门4.5表格索引清单表4餐饮管理系统表格索引清单名称代码唯一 的群集 器主要 的外键候选 键表格Guest_PKGuest_PKTRUEFALSETRUEFALSEFALSE顾客Use_FKUse_FKFALSEFALSEFALSETRUEFALSE顾客SettleAccounts_FKSettleAccounts_FKFALSEFALSEFALSETRUEFALSE顾客Order_FKOrder_FKFALSEFALSEFALSETRUEFALSE顾客Cooking_FKCooking_FKFALSEFALSEFALSETRUEFALSE顾客Food_PKFood_PKTRUEFALSETRUEFALSEFALSE菜单Table_PKTable_PKTRUEFALSETRUEFALSEFALSE餐桌Bill_PKBill_PKTRUEFALSETRUEFALSEFALSE账单SettleAccounts2_FKSettleAccounts2_FKFALSEFALSEFALSETRUEFALSE账单FinanceManage_FKFinanceManage_FKFALSEFALSEFALSETRUEFALSE账单Kitchen_PKKitchen_PKTRUEFALSETRUEFALSEFALSE厨房FnanceDepartmen t PKFnanceDepartmentPKTRUEFALSETRUEFALSEFALSE财务部门4.6表格厨房4.6。

1表格厨房的列清单表5餐饮管理系统表格厨房的列清单名称代码厨师编号CookID厨师姓名CookName烹饪时间CookingTime4.7表格菜单4.7.1表格菜单的列清单表6餐饮管理系统表格菜单的列清单名称代码菜式编号FoodID名称代码菜式名称FoodName菜式价格FoodPrice菜式详情FoodDescription4.8表格财务部门4.8.1表格财务部门的列清单表7餐饮管理系统表格财务部门的列清单名称代码职员编号WorkerID职员姓名WorkerName审查日期ReviewDate填表日期FillingDate4.9表格账单4.9.1表格账单的列清单表8餐饮管理系统表格账单的列清单名称代码账单编号BillID顾客编号GuestID职员编号WorkerID消费总额FoodAllPrice经手人PersonHanding4.10 表格顾客4.10.1表格顾客的列清单表9餐饮管理系统表格顾客的列清单名称代码顾客编号GuestID厨师编号CookID餐桌编号TableID账单编号BillID菜式编号FoodID顾客人数GuestNum消费数量FoodSum4.11 表格餐桌4.11.1表格餐桌的列清单表10餐饮管理系统表格餐桌的列清单名称代码餐桌编号TableID餐桌位置TableLocation餐桌状态TableStatus餐桌类型TableType5开发与编码5。

1表格厨房的代码预览if exists (select 1from dbosysreferences r join dbo.sysobjects o on (o.id = r.constid and otype = 'F') where rfkeyid = object_id ('Guest') and o.name = 'FK_GUEST_COOKING_KITCHEN') alter table Guestdrop constraint FK_GUEST_COOKING_KITCHENgoif exists (select 1from sysobjectswhere id = object_id ('Kitchen')and type = 'U')drop table Kitchengo/* Table: Kitchen *//*==============================================================*/ create table Kitchen (CookID int not null,CookName varchar (50) null,CookingTime datetime null,constraint PK_KITCHEN primary key nonclustered (CookID) ) go5.2表格菜单的代码预览if exists (select 1from dbo.sysreferences r join dbo。

sysobjects o on (o.id = rconstid and o.type = 'F') where rfkeyid = object_id('Guest') and oname = 'FK_GUEST_ORDER_FOOD') alter table Guestdrop constraint FK_GUEST_ORDER_FOODgoif exists (select 1from sysobjectswhere id = object_id ('Food')and type =,U')drop table Foodgo/*==============================================================*//* Table: Food *//*============================================================== */ create table Food (FoodID int not null,FoodName varchar(50) null,FoodPrice decimal (9) null,FoodDescription varchar(200) null,constraint PK_FOOD primary key nonclustered (FoodID )) go5。

3表格财务部门的代码预览if exists (select 1from dbo.sysreferences r join dbo sysobjects o on (oid = r.constid and otype = 'F') where r.fkeyid = object_id('Bill') and oname = 'FK_BILL_FINANCEMA_FNANCEDE') alter table Billdrop constraint FK_BILL_FINANCEMA_FNANCEDEgoif exists (select 1from sysobjectswhere id = object id('FnanceDepartment')and type =,U')drop table FnanceDepartment go/*============================================================== *// * Table: FnanceDepartment */==============================================================*/create table FnanceDepartment (WorkerIDintnot null,WorkerNamevarchar (50)null,ReviewDatedatetimenull,FillingDatedatetimenull,constraint PK_FNANCEDEPARTMENT primary key nonclustered (WorkerlD))go5.4表格账单的代码预览if exists (select 1from dbo.sysreferences r join dbo。

sysobjects o on (oid = rconstid and o.type = 'F') where rfkeyid = object_id ('Bill') and o.name = 'FK_BILL_FINANCEMA_FNANCEDE') alter table Billdrop constraint FK_BILL_FINANCEMA_FNANCEDEgoif exists (select 1from dbosysreferences r join dbo.sysobjects o on (oid = rconstid and o.type = 'F') where r.fkeyid = object_id ('Bill') and oname = 'FK_BILL_SETTLEACC_GUEST') alter table Billdrop constraint FK_BILL_SETTLEACC_GUESTgoif exists (select 1from dbo.sysreferences r join dbo sysobjects o on (o.id = r。

constid and o.type = 'F') where r.fkeyid = object_id('Guest') and o.name = 'FK_GUEST_SETTLEACC_BILL') alter table Guestdrop constraint FK_GUEST_SETTLEACC_BILL goif exists (select 1fromsysindexeswhereid = object_id ('Bill')andname = 'FinanceManageandindid > 0andindid 〈 255)drop index BillFinanceManage_FKgoif exists (select 1FK'from sysindexeswhere id = object_id ('Bill')and name = 'SettleAccounts2_FK'and indid〉 0and indid < 255)drop index Bill.SettleAccounts2_FKgoif exists (select 1from sysobjectswhere id = object_id ('Bill')and type =,U,)drop table Billgo/*============================================================== *//* Table: Bill *//*============================================================== */ create table Bill (BillID int not null,GuestID int null,WorkerlD int null,FoodAllPrice decimal(9) null,PersonHanding varchar (50) null,constraint PK_BILL primary key nonclustered (BillID ))go/ * Index: SettleAccounts2_FK *//*==============================================================*/ create index SettleAccounts2_FK on Bill (GuestID ASC)go/*============================================================== *//* Index: FinanceManage_FK *// * ============================================================== */create index FinanceManage_FK on Bill (WorkerID ASC)goalter table Billadd constraint FK_BILL_FINANCEMA_FNANCEDE foreign key (WorkerID ) references FnanceDepartment (WorkerID)goalter table Billadd constraint FK_BILL_SETTLEACC_GUEST foreign key (GuestID) references Guest (GuestID )go5.5表格顾客的代码预览if exists (select 1from dbo.sysreferences r join dbo。

sysobjects o on (o.id = rconstid and otype = 'F') where r.fkeyid = object_id('Bill') and oname = 'FK_BILL_SETTLEACC_GUEST') alter table Billdrop constraint FK_BILL_SETTLEACC_GUESTgoif exists (select 1from dbosysreferences r join dbo.sysobjects o on (o.id = r.constid and o.type = 'F') where rfkeyid = object_id ('Guest') and oname = 'FK_GUEST_COOKING_KITCHEN') alter table Guestdrop constraint FK_GUEST_COOKING_KITCHENgoif exists (select 1from dbosysreferences r join dbo.sysobjects o on (o id = r.constid and o.type = 'F') where r。

fkeyid = object_id ('Guest') and o.name = 'FK_GUEST_ORDER_FOOD') alter table Guestdrop constraint FK_GUEST_ORDER_FOODgoif exists (select 1from dbo.sysreferences r join dbo sysobjects o on (oid = rconstid and otype = 'F') where r.fkeyid = object_id ('Guest') and o.name = 'FK_GUEST_SETTLEACC_BILL') alter table Guestdrop constraint FK_GUEST_SETTLEACC_BILLgoif exists (select 1from dbo.sysreferences r join dbo.sysobjects o on (oid = r.constid and otype = 'F') where r.fkeyid = object_id ('Guest') and o。

name = 'FK_GUEST_USE_TABLE') alter table Guestdrop constraint FK_GUEST_USE_TABLEgoif exists (select 1from sysindexeswhere id = object id ('Guest')andname = 'Cooking_FK'andindid > 0andindid < 255)drop index Guest.Cooking_FKgoif exists (select 1fromsysindexeswhereid = object_id('Guest')andname = 'Order FK'andindid〉 0andindid 〈 255)drop index Guest cOrder_FKgoif exists (select 1fromsysindexeswhereid = object_id('Guest')andname = 'SettleAccounts_FKandindid〉 0andindid < 255)drop index Guest cSettleAccounts_FKgoif exists (select 1fromsysindexeswhereid = object_id ('Guest')andname = 'Use_FK'andindid > 0andindid < 255)drop index Guest.Use_FKgoif exists (select 1fromsysobjectswhereid = object_id('Guest')andtype = 'U')drop table Guestgo*// * Table: Guest*//**/create table Guest (GuestIDintnot null,CookIDintnull,TablelDintnull,BillIDintnull,FoodIDintnull,GuestNumintnull,FoodSumintnull,constraint PK_GUEST primary key nonclustered (GuestID ))go/* Index: Use FK*/create index Use_FK on Guest (TableID ASC goX Index: SettleAccounts_FK*/=__*/create index SettleAccounts_FK on Guest (BillID ASC go/**//* Index: Order FK create index Order FK on Guest (FoodID ASC go*//* Index: Cooking_FK/*=============== create index Cooking_FK on Guest (CookID ASC go alter table Guestadd constraint FK_GUEST_COOKING_KITCHEN foreign key (CookID ) references Kitchen (CookID )goalter table Guestadd constraint FK_GUEST_ORDER_FOOD foreign key (FoodID ) references Food (FoodID)goalter table Guestadd constraint FK_GUEST_SETTLEACC_BILL foreign key (BillID) references Bill (BillID )go alter table Guestadd constraint FK_GUEST_USE_TABLE foreign key (TableID) references ”Table" (TableID)go5。

6表格餐桌的代码预览if exists (select 1from dbosysreferences r join dbosysobjects o on (oid = rconstid and otype = 'F') where rfkeyid = object_id ('Guest') and o name = 'FK_GUEST_USE_TABLE') alter table Guestdrop constraint FK_GUEST_USE_TABLEgoif exists (select 1from sysobjectswhere id = object_id ('"Table”')and type = 'U')drop table "Table"go/*============================================================== *//* Table: "Table" 卞/*/create table "Table"(TableIDint。

下载提示
相关文档
正为您匹配相似的精品文档