————创建Oracle用户
Create Userhotel
Identified By hotel Default Tablespace users
Quota 20m On users
Account Unlock;Grant Dba To hotel;
Grant Create Table To hotel;
Grant Create Sequence To hotel;
-----员工表
create table register
(
    employeeid varchar2(20) Primary key,
    type char(1)  
)
Comment On table register Is '员工表';
Comment On Column register.employeeid Is '员工类型';
Comment On Column register.type Is 
'员工类型 G-管理者,F-房间管理者,S-收银人员,Q-前台人员,';
-----登陆用户
Create Table login
(
       employeeid Varchar2(20) Primary Key,
       username Varchar2(20) unique ,
       Password varchar2(20),
       Type Char(1)
);
-----房间信息
Create Table room 
(
roomid varchar2(4) Primary Key,
roomlocation Varchar2(20),
roomstate varchar2(10),
machine Varchar2(100),
roomtype Varchar2(10)
)
Comment On Table room Is '房间表';
Comment On Column room.roomidIs '房间编号';
Comment On Column room.roomlocationIs '房间位置';
Comment On Column room.roomstateIs '房间状态';
Comment On Column room.roomstateIs '房间设备';Comment On Column room.roomtypeIs '房间类型';----房间编号序列
Create Sequence roomid_seq Increment By 1 Start With 01
Nocache;---预订信息
Create Table book
(
bookid number(10) Primary Key,
bookdate date,
customername Varchar2(10),
roomid varchar2(4)
)
---预订编号序列
Create Sequence bookid_seq Increment By 1 Start With 1000000001 Nocache;
Comment On Table book Is '预订表';
Comment On Column book.bookidIs '预订编号';
Comment On Column book.bookdateIs '预订时间 ';
Comment On Column book.customernameIs '客户姓名';
Comment On Column book.roomidIs '房间编号';---客户信息
Create Table customer
(
customerid number(10) Primary Key,
customername Varchar2(20),
customernum Varchar2(20),
customersex varChar2(4),
customeraddress Varchar2(50),
customerphone Varchar2(20)
)
Comment On Table customer Is '客户表';
Comment On Column customer.customeridIs '客户编号';
Comment On Column customer.customernumIs '客户身份证号码';
Comment On Column customer.customersexIs '客户性别';
Comment On Column customer.customeraddressIs '客户地址';Comment On Column customer.customerphoneIs '客户联系方式';
---客户编号序列
Create Sequence customerid_seq Increment By 1 Start With 1000000001 Nocache;
---入住信息
Create Table live
(
liveid number(10)Primary Key,
deposit number(4),
isinternet char(1),
roomid varchar2(4),
customerid number(10),
indate date,
outdate date
)
Comment On Table liver Is '入住表';
Comment On Column live.liveidIs '入住编号';
Comment On Column live.depositIs '押金';
Comment On Column live.isinternetIs '是否开通 Y-是 N-否';
Comment On Column customer.roomid Is '房间编号';Comment On Column customer.customeridIs '客户编号';
 
Comment On Column customer.indateIs '入住时间';
Comment On Column customer.outdate Is '退宿时间';
-----入住编号序列
Create Sequence liveid_seq Increment By 1 Start With 1000000001 Nocache;
--房间单价表
Create table roomsale
(
roomtype varchar(10) primary key,
roomprice number(4)
)
insert into roomsale values('单人标准间',168);
insert into roomsale values('双人标准间',268);
insert into roomsale values('豪华双人间',288);
insert into roomsale values('豪华三人间',368);
insert into roomsale values('总统套房',568);
--网络
create table internet
(
internetid number(10),
roomid varchar2(4),
customerid number(10),
opendate Date,
closedate Date
)
---网络编号序列
Create Sequence internetid_seq Increment By 1 Start With 1000000001 Nocache;
Comment On Table internet Is '网络信息表';
Comment On Column internet.internetid Is '网络编号';
Comment On Column internet.roomid Is '房间编号 ';
Comment On Column internet.customerid Is '客户编号 ';
Comment On Column internet.opendateIs '开通时间 ';
Comment On Column internet.closedateIs '关闭时间 ';