酒店订餐系统数据库设计和实现文档格式.docx
《酒店订餐系统数据库设计和实现文档格式.docx》由会员分享,可在线阅读,更多相关《酒店订餐系统数据库设计和实现文档格式.docx(6页珍藏版)》请在冰豆网上搜索。
Createtableorder_list
(Lnumberchar(9)primarykey, /*订单编号*/Chinastyle_foodchar(20), /*中餐*/
Westernstyle_foodchar(20), /*西餐*/
medical_foodchar(20), /*药膳菜品*/
snackchar(20) /*小吃*/
Createtablelistorder
(Lnumberchar(9)primarykey, /*订单编号*/Delivery_orderchar(20), /*顶单状态*/
Unumberchar(20), /*订餐者编号*/
时间datetime,
alllist decimal(6,2), /*合计*/
Cnumberchar(20) /*管理员编号*/
Createtable用户
(Unumberchar(9)primarykey, /*会员帐号*/Unamechar(20), /*姓名*/
Usexchar(4)default'
男'
/*性别*/
Ucodechar(9), /*密码*/
Telephonechar(12), /*常用电话*/
Addresschar(40) /*收货具体地点*/
Createtablecontroller
(Cnumberchar(9)primarykey, /*管理员编号*/
Cnamechar(20), /*管理员姓名*/
Csexchar(4), /*管理员性别*/
Cagesmallint, /*管理员年龄*/
Cdepartmentchar(20) /*管理员部门*/
Createtablefood_data
/*菜品资料*/
(systemschar(10),
/*菜系*/
Countrychar(20),
/*国家*/
Diseasechar(20),
/*不同疾病*/
Namechar(20)primarykey,
/*菜名*/
Producechar(200),
/*制作*/
Pricefloat(6)
/*价格*/
Createtablebusiness /*配送交易*/
(
Cnumberchar(9)notnull, /*管理员编号*/Lnumberchar(9), /*订单编号*/
Delivery_orderchar(20), /*执行命令*/
日期datetime /*送货日期*/
/*建立索引*/
createuniqueindexfoodonfood_data(name)createuniqueindexlistonorder_list(Lnumber)createuniqueindexuserson用户(Unumber)
CreateviewChinastyle_foodAs
Selectname,produce,priceFromfood_data
Wheresystems='
鲁菜'
CreateviewWesternstyle_food
As
Wherecountry='
美国'
Createviewmedical_food /*药膳菜品*/As
Selectname,produce,price
Fromfood_dataWheredisease='
心脏'
Createviewsnack /*小吃*/As
Selectproduce,price
Fromfood_dataWherename='
炒粉'
createprocedureinsertfood(
@Systemschar(10), /*菜系*/
@Countrychar(20), /*国家*/
@Diseasechar(20)='
无'
/*不同疾病*/@Namechar(20), /*菜名*/
@Producechar(200)='
/*制作*/
@Pricefloat(6)
as
insertintofood_datavalues(@Systems,@Country,@Disease,@Name,@Produce,@Price)
exec insertfood @Systems='
@Country='
中国'
@Disease='
养育'
@Name='
烤鸭'
@Produce='
香辣'
@Price=55
delete
fromfood_datawherename='
水煮牛肉'
createtriggerchangedisplay1onfood_data
forinsert
select*fromfood_data
createprocedureinsertuser(
@Unumberchar(9), /*会员帐号*/
@Unamechar(20), /*姓名*/
@Usexchar(4), /*性别*/
@Ucodechar(9), /*密码*/
@Telephonechar(12), /*常用电话*/@Addresschar(40)
insertinto用户values(@Unumber,@Uname,@Usex,@Ucode,@Telephone,@Address)
exec insertuser @Unumber='
09001'
@Uname='
常在k'
@Usex='
女'
@Ucode='
123457'
@Telephone='
15100002222'
@Address=胜'
利路3号'
deletefrom用户
whereunumber='
createtriggerchangedisplay2on用户
forinsertas
select*frominserted
createprocedureinsertorder(
@Lnumberchar(9),
@Chinastyle_foodchar(20),
/*订单编号*/
/*中餐*/
@Westernstyle_foodchar(20),
@medical_foodchar(20),
/*西餐*/
/*药膳菜品*/
@snackchar(20)
/*小吃*/
insertintoorder_listvalues(@Lnumber,@Chinastyle_food,@Westernstyle_food,@medical_food,@snack)
exec insertorder @Lnumber='
090806'
@Chinastyle_food='
童子鸡
'
@Westernstyle_food='
意大利面'
@medical_food='
瓦罐汤'
@snack='
泡粉'
fromorder_list
whereLnumber='
090801'
*****************************************createtriggerchangedisplay3
onorder_list
select*fromorder_list
createprocedureinsertbusiness(
@Cnumberchar(9),
/*管理员编号*/
@Delivery_orderchar(20),
@日期datetime)
/*执行命令*/
/*送货日期*/
insertintobusinessvalues(@Cnumber,@Lnumber,@Delivery_order,@日期)
execinsertbusiness@Cnumber='
080909'
@Lnumber='
090809'
@Delivery_order=等'
待发送'
@日期='
2009-08-25'
from business
createprocedureupdatebusiness(
@Cnumberchar(9), /*管理员编号*/
@Lnumberchar(9) /*订单编号*/
updatebusiness
setDelivery_order='
发送'
whereDelivery_order='
等待发送'
andlnumber=@Lnumberandcnumber=@Cnumber
execupdatebusiness@Lnumber='
090809'
@Cnumber='
createtriggerchangedisplay4onbusiness
forupdate
select*frombusiness