Answered step by step
Verified Expert Solution
Question
1 Approved Answer
CREATE TABLE Hotels ( HotelID INT PRIMARY KEY, Name VARCHAR ( 2 5 5 ) , Address VARCHAR ( 2 5 5 ) , City
CREATE TABLE Hotels
HotelID INT PRIMARY KEY,
Name VARCHAR
Address VARCHAR
City VARCHAR
State VARCHAR
Phone VARCHAR
;
CREATE TABLE Customers
CustomerID INT PRIMARY KEY,
Name VARCHAR
Address VARCHAR
Phone VARCHAR
CreditCardInfo VARCHAR
;
CREATE TABLE Reservations
ReservationID INT PRIMARY KEY,
CustomerID INT,
HotelID INT,
RoomType INT,
StartDate DATE,
EndDate DATE,
Rate DECIMAL
DateOfReservation DATE,
TotalAmount DECIMAL
FOREIGN KEY CustomerID REFERENCES CustomersCustomerID
FOREIGN KEY HotelID REFERENCES HotelsHotelID
;
CREATE TABLE RoomTypes
RoomTypeID INT PRIMARY KEY,
HotelID INT,
RoomType VARCHAR
PricePerNight DECIMAL
Availability INT,
FOREIGN KEY HotelID REFERENCES HotelsHotelID
;
CREATE TABLE Services
ServiceID INT PRIMARY KEY,
ServiceType VARCHAR
Price DECIMAL
;
CREATE TABLE ReservationServices
ReservationServiceID INT PRIMARY KEY,
ReservationID INT,
ServiceID INT,
Dt DATE,
Quantity INT,
TotalAmount DECIMAL
FOREIGN KEY ReservationID REFERENCES ReservationsReservationID
FOREIGN KEY ServiceID REFERENCES ServicesServiceID
;
Creating the relationship: Reservations to RoomTypes ManytoOne
ALTER TABLE Reservations
ADD FOREIGN KEY RoomType REFERENCES RoomTypesRoomTypeID;
Insert records into Hotels table
INSERT INTO Hotels HotelID Name, Address, City, State, Phone VALUES
'Grand Hotel', Main St 'Springfield', IL;
INSERT INTO Hotels HotelID Name, Address, City, State, Phone VALUES
'Ocean View', Beach Rd 'Miami', FL;
INSERT INTO Hotels HotelID Name, Address, City, State, Phone VALUES
'Mountain Inn', Hill St 'Denver', CO;
INSERT INTO Hotels HotelID Name, Address, City, State, Phone VALUES
'City Center Hotel', City Ave', 'New York', NY;
INSERT INTO Hotels HotelID Name, Address, City, State, Phone VALUES
'Desert Retreat', Desert Rd 'Phoenix', AZ;
Insert records into Customers table
INSERT INTO Customers CustomerID Name, Address, Phone, CreditCardInfo VALUES
'John Doe', Oak St;
INSERT INTO Customers CustomerID Name, Address, Phone, CreditCardInfo VALUES
'Jane Smith', Pine St;
INSERT INTO Customers CustomerID Name, Address, Phone, CreditCardInfo VALUES
'Robert Brown', Maple St;
INSERT INTO Customers CustomerID Name, Address, Phone, CreditCardInfo VALUES
'Emily Davis', Elm St;
INSERT INTO Customers CustomerID Name, Address, Phone, CreditCardInfo VALUES
'Michael Johnson', Cedar St;
Insert records into RoomTypes table
INSERT INTO RoomTypes RoomTypeID HotelID, RoomType, PricePerNight, Availability VALUES
'Single', ;
INSERT INTO RoomTypes RoomTypeID HotelID, RoomType, PricePerNight, Availability VALUES
'Double', ;
INSERT INTO RoomTypes RoomTypeID HotelID, RoomType, PricePerNight, Availability VALUES
'Suite', ;
INSERT INTO RoomTypes RoomTypeID HotelID, RoomType, PricePerNight, Availability VALUES
'Single', ;
INSERT INTO RoomTypes RoomTypeID HotelID, RoomType, PricePerNight, Availability VALUES
'Double', ;
Insert records into Services table
INSERT INTO Services ServiceID ServiceType, Price VALUES
'Room Service', ;
INSERT INTO Services ServiceID ServiceType, Price VALUES
'Spa', ;
INSERT INTO Services ServiceID ServiceType, Price VALUES
'Gym Access', ;
INSERT INTO Services ServiceID ServiceType, Price VALUES
'Laundry', ;
INSERT INTO Services ServiceID ServiceType, Price VALUES
'Parking', ;
Insert records into Reservations table
INSERT INTO Reservations ReservationID CustomerID, HotelID, RoomType, StartDate, EndDate, Rate, DateOfReservation, TotalAmount VALUES
;
INSERT INTO Reservations ReservationID CustomerID, HotelID, RoomType, StartDate, EndDate, Rate, DateOfReservation, TotalAmount VALUES
;
INSERT INTO Reservations ReservationID CustomerID, HotelID, RoomType, StartDate, EndDate, Rate, DateOfReservation, Tota
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started