2005级信管专业2班数据库应用系统课程设计课程论文
表3-4 房态信息
列名 Rno Gno Atime Ltime Rtime Rltime IntoPrice Days Stime flag
表3-5娱乐项目信息
列名 Atno Atname Atprice
数据类型 char(20) char(20) float
可否为空 not null not null not null
说明 娱乐项目编号 娱乐项目名称
娱乐项目单价(时间计费或个数计费)
数据类型 char(10) char(20) datetime datetime datetime datetime float int datetime char(1)
可否为空 not null not null
说明 房间号 顾客号 实际入住时间 实际退房时间 预订入住时间 预订退房时间 入住价格 入住天数 修改记录时间 预订入住标志位
表3-6娱乐消费信息
列名 Gno Atno Amount Wtime
数据类型 char(20) char(20) float datetime
可否为空 not null not null
not null
说明 顾客号 商品号 消费数量 消费开始时间
表3-7物品赔偿信息
列名 Gno Rno Goodsno Dnum Amendstime
数据类型 char(20) char(10) char(20) int datetime
可否为空 not null not null not null
Datetime
说明 顾客号 房间号 物品号 损坏个数 损坏时间
3.2用户子模式定义
25
2005级信管专业2班数据库应用系统课程设计课程论文
表3-8 订房视图
列名 Gno Rno Rtype Rfloor Toward IntoPrice Rtime Rltime Days Wtime
数据类型 char(20) char(10) char(20) smallint char(10) float datetime datetime int datetime
可否为空 not null not null not null not null not null not null not null not null not null not null
说明 顾客号 房间号 房间类型 房间楼层 房间朝向 入住价格 入住时间 打算退房时间 居住天数 查看时时间
表3-9 入住视图
列名 Gno Gname Rno Rtype Rfloor Toward IntoPrice Atime Ltime Days Account Wtime
数据类型 char(20) char(20) char(10) char(20) smallint char(10) float datetime datetime int float datetime
可否为空 not null not null not null not null not null not null not null not null not null not null not null not null
说明 顾客号 顾客姓名 房间号 房间类型 房间楼层 房间朝向 入住价格 入住时间 退房时间 入住天数 预付金额 查看时时间
表3-10 空房视图
列名 Rno Rtype Rprice Rfloor Toward
数据类型 char(10) char(20) float int char(10)
可否为空 not null not null not null not null not null
说明 房间号 房间类型 入住价格 房间楼层 房间朝向
26
2005级信管专业2班数据库应用系统课程设计课程论文
附录4 SQL语句
4.1 建立数据表SQL语句
(1)顾客基本信息表的建立: create table guest
( Gno char(20) not null, Gname char(20)not null, Gsex char(20) not null, Gid char(18) unique not null, Gtel char(11), Gaddress char(20), Account float, Grade int,
discount float not null, balance float, primary key (Gno),
check (Account >= 0.0 and Grade>0)
)
(2)客房基本信息表的建立: create table Roominfo
( Rno char(10), Rtype char(20)not null, Rprice float not null, Rfloor smallint not null,
Toward char(10)not null, primary key (Rno),
check (Rfloor between 1 and 100),
check (Toward in('正北','正南','正西','正东','东北','西南','西北','东南')), check (Rtype in('标准1','标准2','豪华1','豪华2','高级1','高级2')), )
(3)房态表的建立: create table RoomState
(Rno char(10), Gno char(20), Atime datetime , Ltime datetime,
27
2005级信管专业2班数据库应用系统课程设计课程论文
Rtime datetime, Rltime datetime, IntoPrice float , Days int , Stime datetime, flag char(1) ,
primary key (Rno,Gno),
foreign key (Rno)references Roominfo(Rno), foreign key (Gno)references guest(Gno), check (flag in('1','2','3')),
)
(4)娱乐项目基本信息表的建立: create table Atariff
( Atno char(20), Atname char(20)not null, Atprice float not null, primary key (Atno), check (Atprice >0.0) )
(5)顾客娱乐消费信息表的建立: create table Consumelist
( Gno char(20), Atno char(20), Amount float,
Wtime datetime not null, primary key(Gno,Atno),
foreign key (Gno)references guest(Gno), foreign key (Atno)references Atariff(Atno) )
(6)客房物品基本信息表的建立: create table RoGoInfo
( Goodsno char(20),
Goodsname char(20)not null, Oprice float not null, Dmultiple float not null, primary key (Goodsno) )
(7)顾客赔偿物品信息表的建立: create table GoAmInfo
(Gno char(20),
28
相关推荐: