Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What is wrong with my hotel design

Status
Not open for further replies.

suomenfani

Programmer
Jun 3, 2006
1
BG
Hi,

I am new to db's and I need to make a very simple model of a hotel. I prepared it, but i was told it wasnt good because the business model is mixed up with the database. However, I have no idea what that means and what is wrong with the tables. Here are the tables, can I you tell me why the design isnt good?

Thank you so much.



---------------------------

CREATE TABLE Guest (

name varchar(20),
reservNum number,
CONSTRAINT Guest_PK primary key(reservNum)
);


CREATE TABLE RoomService(

item varchar(20),
price number NOT NULL,

CONSTRAINT RoomService_PK
primary key (item)
);


CREATE TABLE Room(

hotel varchar(20),
num number(3),
floor number(2),
type varchar(10),

CONSTRAINT Room_PK PRIMARY KEY (hotel, num),
CONSTRAINT Room_Type CHECK (type IN (‘single’ ,’double’, ‘apartment’))
);


CREATE TABLE Reserve(

hotel varchar(20),
reservNum number,
room number,
checkin date NOT NULL,
checkout date NOT NULL,
pricePerNight number NOT NULL,
Boolean booked;

CONSTRAINT Reserve_PK PRIMARY KEY (reservNum),

FOREIGN KEY (hotel,room) REFERENCES Room(hotel,num) ON DELETE CASCADE,
FOREIGN KEY (reservNum) REFERENCES Guest(reservNum) ON DELETE CASCADE
);


CREATE TABLE Consumes(

reservNum number,
itemUsed varchar(20)NOT NULL,
quantity number,

FOREIGN KEY (reservNum) REFERENCES Guest(reservNum) ON DELETE CASCADE,
FOREIGN KEY (itemUsed) REFERENCES RoomService(item) ON DELETE CASCADE);


CREATE TABLE Bill(

reservNum number,
roomServiceTotal number,
roomTotal number,
GrandTotal number,

FOREIGN KEY (reservNum) REFERENCES Guest(reservNum) ON DELETE CASCADE
);









 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top