资源描述:
《酒店管理系统数据库代码》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、酒店客房管理系统数据库创建代码酒店管理系统数据库代码useHotel_Management1select*fromCustomerselect*fromEmployeeselect*fromRoomTypeselect*fromRoomselect*fromOrderInfoselect*fromCheckoutdropdatabaseHotel_Management1------------------------创建数据库Hotel_Management-------------------------------------
2、---------------------------------createdatabaseHotel_MDBonprimary(name=Hotel_Management1,filename='F:Hotel_ManagementHotel_Management.MDF',size=10MB,filegrowth=20%)logon(name=Hotel_Management1,filename='F:Hotel_ManagementHotel_Management1.LDF',size=10MB,filegrowth
3、=2MB)--使用数据库USEHotel_Management1--------------------------------------------创建表-----------------------------------------------------------------1顾客表createtableCustomer(CustomerIDintprimarykey,CustomerNamenvarchar(40)notnull,CustomerInfonvarchar(18)notnull,Csexnvarchar
4、(1),CPhonenvarchar(11)notnull,Notesntext)--droptableCustomer--2员工表8酒店客房管理系统数据库创建代码createtableEmployee(EmployeeIDintprimarykey,UserNamenvarchar(40)notnull,Passwordnvarchar(40)notnull,EmployeeNamenvarchar(40)notnull,Esexnvarchar(1),EPhonenvarchar(11)notnull,Notesntext)-
5、-3客房表(有外键)createtableRoom(RoomIDintprimarykey,RoomTypeIDintnotnull,RoomStatenvarchar(1)notnull,Notesntext,FOREIGNKEY(RoomTypeID)REFERENCESRoomType(RoomTypeID),)--droptableRoom--4客房类型表(有外键)createtableRoomType(RoomTypeIDintprimarykey,RoomTypeNamenchar(20)notnull,Costflo
6、at,Totalint,Surplusint,Notesntext,)--droptableRoomType--5订房表select*fromOrderInfocreatetableOrderInfo(OrderIDintnotnullprimarykey,RoomIDintnotnull,CustomerIDint,EmployeeIDint,Entertimedatetimenotnull,Depositfloat,ORstaticnvarchar(10)notnull,Notesntext,FOREIGNKEY(Custom
7、erID)REFERENCESCustomer(CustomerID),FOREIGNKEY(RoomID)REFERENCESRoom(RoomID),8酒店客房管理系统数据库创建代码FOREIGNKEY(EmployeeID)REFERENCESEmployee(EmployeeID),)--altertableaddconstraintOI_DORstaticdefault'use'--droptableOrderInfo--6退房表check-outcreatetableCheckout(CheckoutIDintprim
8、arykey,RoomIDintnotnull,CustomerIDint,EmployeeIDint,Entertimedatetimenotnull,Endtimedatetimenotnull,Total_consumptionfloat,N