资源描述:
《酒店订餐系统数据库设计和实现.doc》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、createdatabase酒店订餐系统on(name=酒店订餐,filename='D:酒店订餐.mdf',size=10,maxsize=50,filegrowth=5)logon(name=酒店订餐_log,filename='D:酒店订餐.ldf',size=5,maxsize=25,filegrowth=5)createtablecookbook(Cooknumberchar(9)primarykey,/*菜单编号*/namechar(20)unique,/*菜单名*/Member_pricefloat(6),/*会员价格*/constraint
2、price_chkcheck(Member_price>=0))Createtableorder_list(Lnumberchar(9)primarykey,/*订单编号*/Chinastyle_foodchar(20),/*中餐*/Westernstyle_foodchar(20),/*西餐*/medical_foodchar(20),/*药膳菜品*/snackchar(20)/*小吃*/)Createtablelistorder(Lnumberchar(9)primarykey,/*订单编号*/Delivery_orderchar(20),/*顶单状态*/
3、Unumberchar(20),/*订餐者编号*/时间datetime,alllistdecimal(6,2),/*合计*/Cnumberchar(20)/*管理员编号*/)Createtable用户(Unumberchar(9)primarykey,/*会员帐号*/Unamechar(20),/*姓名*/Usexchar(4)default'男',/*性别*/Ucodechar(9),/*密码*/Telephonechar(12),/*常用电话*/Addresschar(40)/*收货具体地点*/)Createtablecontroller(Cnumberc
4、har(9)primarykey,/*管理员编号*/Cnamechar(20),/*管理员姓名*/Csexchar(4),/*管理员性别*/Cagesmallint,/*管理员年龄*/Cdepartmentchar(20)/*管理员部门*/)Createtablefood_data/*菜品资料*/(systemschar(10),/*菜系*/Countrychar(20),/*国家*/Diseasechar(20),/*不同疾病*/Namechar(20)primarykey,/*菜名*/Producechar(200),/*制作*/Pricefloat(6)
5、/*价格*/)Createtablebusiness/*配送交易*/(Cnumberchar(9)notnull,/*管理员编号*/Lnumberchar(9),/*订单编号*/Delivery_orderchar(20),/*执行命令*/日期datetime/*送货日期*/)/*建立索引*/createuniqueindexfoodonfood_data(name)createuniqueindexlistonorder_list(Lnumber)createuniqueindexuserson用户(Unumber)CreateviewChinastyle_
6、foodAsSelectname,produce,priceFromfood_dataWheresystems='鲁菜'CreateviewWesternstyle_foodAsSelectname,produce,priceFromfood_dataWherecountry='美国'Createviewmedical_food/*药膳菜品*/AsSelectname,produce,priceFromfood_dataWheredisease='心脏'Createviewsnack/*小吃*/AsSelectproduce,priceFromfood_dat
7、aWherename='炒粉'createprocedureinsertfood(@Systemschar(10),/*菜系*/@Countrychar(20),/*国家*/@Diseasechar(20)='无',/*不同疾病*/@Namechar(20),/*菜名*/@Producechar(200)='无',/*制作*/@Pricefloat(6))asinsertintofood_datavalues(@Systems,@Country,@Disease,@Name,@Produce,@Price)execinsertfood@Systems='鲁菜'
8、,@Country='中国',@Dis