数据库餐厅点菜管理系统内容摘要:

int Not null 数字 是否占用 独立 表 Member 数据项名与别名 类型 (长度 ) 是否为空 数据约束 数据项含义说明 与其他数据项的联系 memberNo Char( 7) Not null 字符 M加 6个数字 顾客编号 主键 memberLevel Char( 5) Not null 字符 顾客等级 独立 memberCount int Not null 数字, 0到10000 顾客积分 独立 memberName Char( 20) Not null 字符 顾客名字 独立 memberSex Char( 1) Not null 字符 顾客性别 独立 memberBirth datetime null 日期 顾客生日 独立 表 科学套餐表 Smeal 数据项名与别名 类型 (长度 ) 是否为空 数据约束 数据项含义说明 与其他数据项的联系 16 smealNo Char( 7) Not null 以字母 S开头加六位数字 套餐编号 主键 sPrice numeric( 7,2) Not null 数字 套餐价格 由菜品价格计算得来,参照表 Dishes dishesNo Char( 7) Not null G 字符加 6个数字 菜品编号 dishesNO benefit varChar(20) Not null 字符 套餐功能 独立 表 菜单表 Menu 数据项名与别名 类型 (长度 ) 是否为空 数据约束 数据项含义说明 与其他数据项的联系 menuNo Char( 12) Not null 以字母 C开头加 11位数字 菜单编号 主键 menuDate datetime Not null 数字 时间 独立 tableNo Char( 4) Not null R 字符加 3个数字 桌台编号 外键,参照Table 表 menuSum int Not null 数字 菜单总价 由明细表中的菜品价格和菜品数量计算得出 表 MenuDetail 数据项名与别名 类型 (长度 ) 是否为空 数据约束 数据项含义说明 与其他数据项的联系 menuNo Char( 12) Not null 以字母 C开头加 11位数字 菜单编号 主键、外键,参照 Menu 表 dishesNo Char( 7) Not null G 字符加 6个数字 菜品编号 主键、外键,参照 Dishes表 Price numeric( 7,2) Not 数字 菜品价格 与菜品对应 qty Int Not null 数字 菜品数量 独立 表 科学套餐明细表 SmealDetail 17 数据项名与别名 类型 (长度 ) 是否为空 数据约束 数据项含义说明 与其他数据项的联系 smealNo Char( 12) Not null 有系统自动按时间提供 科学套餐编号 主键、外键,参照 Menu 表 dishesNO Char( 7) Not null G 字符加 6个数字 菜品编号 主键、外键,参照 Dishes表 Price numeric( 7,2) Not 数字 菜品价格 与菜品对应 表 评价表 Evaluate 数据项名与别名 类型 (长度 ) 是否为空 数据约束 数据项含义说明 与其他数据项的联系 tableNo Char( 4) Not null R 字符加 3个数字 桌台编号 主键、外键,参照 Room 表 dishesNO Char( 7) Not null G 字符加 6个数字 菜品编号 主键、外键,参照 Dishes表 Score Int Not null 数字, 0到10 分数 独立 函数依赖关系: 1) 菜品表 函数依赖集为 F1={菜品编号→(菜 品名称,菜品价格,菜品类型,热量,蛋白质含量,糖分) } ∈ 3NF。 2) 桌台表 函数依赖集为 F2={桌台编号→(容纳人数,桌台等级,是否占用) } ∈3NF。 3) 顾客表 函数依赖集为 F3={顾客编号→(顾客等级,顾客积分,顾客姓名,顾客性别,顾客生日) } ∈ 3NF。 4) 科学套餐表 函数依赖集为 F4={套餐编号→(套餐价格,菜品编号,套餐功能) } ∈3NF。 5) 科学套餐表明细表 函数依赖集为 F5={套餐编号→(菜品编号) } ∈ 3NF。 6) 菜单表 函数依赖集为 F6={菜单编号→(时间) } ∈ 3NF。 7) 菜单明细表 18 函数依赖集为 F7={菜单编号→(菜品编号,菜品价格,实际菜品价格,菜品数量) } ∈ 3NF。 8) 评价表 函数依赖集为 F10={桌台编号→(菜品编号,分数) } ∈ 3NF。 4 数据库应用设计 数据库应用的设计,包括数据库的脚本和安全性设计、数据库的完整性设计和数据库的存储过程设计。 数据库脚本及数据库安全性设计 1) 数据库安全性设计 创建三个用户分别为管理员‘ user01’、前台服务人员‘ qiantai’ 以及顾客‘ customer’,然后根据不同表的功能,赋予他们不同的权限,创建用户代码如下: /* add my user*/ exec sp_adduser user01,user01 exec sp_addlogin 39。 qiantai39。 ,39。 12345639。 ,39。 MenuDB139。 exec sp_adduser 39。 qiantai39。 ,39。 qiantai39。 exec sp_addlogin 39。 customer39。 ,39。 12345639。 ,39。 MenuDB139。 exec sp_adduser 39。 customer39。 ,39。 customer39。 2) 数据库脚本 创建各个用户相关的表,并设计好各表间的主外键联系,规定好个用户的权限,管理员有所有的权限,前台人员对于菜单表只有查看的权限,而顾客对于菜单表有添加修改的作用,代码如下: print39。 creat table Dishes39。 go CREATE TABLE Dishes( dishesNo char(7) not null /*菜品编号 */ check(dishesNo like 39。 [G][09][09][09][09][09][09]39。 ), dishesName varchar(10) not null, /*菜品编号 */ price numeric(7,2) not null, /*菜品价格 */ caloric numeric(7,2) not null, /*热量 */ sugers numeric(7,2) not null, /*糖分 */ protein numeric(7,2) not null, /*蛋白质 */ constraint DishesPK primary key (dishesNo) ) go grant all on Dishes to user01 go print 39。 create Member39。 19 go create table Member( memberNo char(7) not null, /*顾客号 */ check(memberNo like 39。 [C][09][09][09][09][09][09][09][09]39。 ), memberName varchar(40) not null, /*顾客姓名 */ sex char(1) not null, /*性别 */ memberLevel varchar(12) not null, /*顾客等级 */ memberCount int not null, /*顾客积分 */ birthday datetime null, /*顾客生日 */ constraint MemberPK primary key (memberNo) ) go grant all on Member to user01 go print 39。 create table Menu39。 go create table Menu( menuNo char(12) not null , /*菜单编号 */ tableNo char(4) not null, /*桌台编号 */ memberNo char(7) not null, /*顾客号 */ check(memberNo like 39。 [C][09][09][09][09][09][09][09][09]39。 ), meandate datetime not null, /*时间 */ meanSum numeric(7,2) not null, /*菜单总价 */ constraint MenuPK primary key (menuNo), constraint MenuFK1 foreign key(tableNo) references Table1(tableNo), constraint MenuFK2 foreign key(memberNo) references Member(memberNo) ) go grant all on Table1 to user01 go print 39。 create table Table139。 go create table Table1( tableNo char(4) not null , /*桌台编号 */ place int not null, /*容纳人数 */ tableLevel char(10) not null, /*桌台级别 */ constraint Table1PK primary key (tableNo) ) go grant all on Table1 to user01 go print 39。 create table Smeal39。 go create table Smeal( 20 smealNo char(4) not null , /*套餐编号 */ sprice numeric(7,2) not null, /*套餐价格 */ constraint SmealPK primary key (SmealNo) ) go grant all on Smeal to user01 go print 39。 create SmealDetail39。 go create table SmealDetail( smealNo char(4) not null , /*套餐编号 */ dishesNo char(7) not null /*菜品编号 */ check(dishesNo like 39。 [G][09][09][09][09][09][09]39。 ), price numeric(7,2) not null, /*菜品价格 */ constraint SmealDetailPK primary key clustered(smealNo,dishesNo), constraint SmealDetailFK1 foreign key(smealNo) references Smeal(smealNo), constraint SmealDetailFK2 foreign key(dishesNo ) r。
阅读剩余 0%
本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。 用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。