Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CREATE TABLE Hotel ( HotelID INT NOT NULL IDENTITY PRIMARY KEY, HotelName VARCHAR(50) NOT NULL UNIQUE, HotelPhone VARCHAR(12) NOT NULL UNIQUE CHECK(HotelPhone LIKE '[0-9][0-9][0-9]-[0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]'), HotelAddress

CREATE TABLE Hotel ( HotelID INT NOT NULL IDENTITY PRIMARY KEY, HotelName VARCHAR(50) NOT NULL UNIQUE, HotelPhone VARCHAR(12) NOT NULL UNIQUE CHECK(HotelPhone LIKE '[0-9][0-9][0-9]-[0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]'), HotelAddress VARCHAR(50) NOT NULL UNIQUE, HotelCity VARCHAR(30) NOT NULL, HotelState VARCHAR(30) NOT NULL, HotelZip INT NOT NULL CHECK (LEN(HotelZip) = 5) ); CREATE TABLE Room ( RoomID INT NOT NULL IDENTITY PRIMARY KEY, RoomTypeID INT NOT NULL REFERENCES RoomType (RoomTypeID), HotelID INT NOT NULL REFERENCES Hotel (HotelID), RoomNumber INT NOT NULL CHECK(RoomNumber LIKE '[0-9][0-9][0-9]') ); CREATE TABLE RoomType ( RoomTypeID INT NOT NULL IDENTITY PRIMARY KEY, RoomID INT NOT NULL REFERENCES Room (RoomID), TypeName VARCHAR(15) NOT NULL CHECK((TypeName = 'One Bed' OR TypeName = 'Two Beds' OR TypeName = 'Suite')), Handicap BIT NOT NULL -- 0 = No and 1 = yes ); CREATE TABLE Booking ( BookingID INT NOT NULL IDENTITY PRIMARY KEY, RoomID INT NOT NULL REFERENCES Room (RoomID), BookingDate DATE NOT NULL, Rate INT NOT NULL, --price of the room at time of booking StartDate DATE NOT NULL, EndDate DATE NOT NULL, ); CREATE TABLE Customer ( CustomerID INT NOT NULL IDENTITY PRIMARY KEY, BookingID INT NOT NULL REFERENCES Booking (BookingID), FirstName VARCHAR(50) NOT NULL, LastName VARCHAR(50) NOT NULL, CustomerPhone VARCHAR(12) NOT NULL UNIQUE CHECK(CustomerPhone LIKE '[0-9][0-9][0-9]-[0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]'), CustomerEmail VARCHAR(50) NOT NULL, CustomerAddress VARCHAR(50) NOT NULL );

I am struggling to get my Room and RoomType tables to create, how would I fix this?  My other question is would this database design satisfy third normal form? If not what can I do to make it satisfy third normal form?

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction To Java Programming And Data Structures Comprehensive Version

Authors: Y. Daniel Liang

12th Edition

0136520235, 978-0136520238

More Books

Students also viewed these Databases questions

Question

How many applicants are you interviewing?

Answered: 1 week ago

Question

what is the maximum limit for funding a QLAC in 2020?

Answered: 1 week ago