Hotel Database Management System SQL Final
Hotel Database Management System SQL Final
− The hotels in each chain and their details and other information like the rooms
and their description and discounts, etc.
PAGE 1
DEFINE TABLES: Design the tables, columns and relationships
We started with designing the structure of the database. We drew the ERR diagram on a
paper, noting down all the tables required. We designed each table with columns and
attributes respectively. I have designed the below tables:
hotel_services_used_by_guests table
contains info about the services used by the
guests. Primary key is service_used_id & two
foreign keys, hotel_services_service_id, which
relates to hotel_services table &
bookings_booking_id relates to bookings
table.
PAGE 2
employees table consists of data related to the employees.
The primary key is employee_id. There are three foreign
keys, service_id that denotes many-to-one relations with
the department table.
address_id that denotes one-to-one relationship with the
addresses table.
hotel_id that denotes many-to-one relationship with the
hotel table.
guests table has the data about the guests that check
in to the hotel. The primary key of this table is guest_id.
there is one foreign key in this table, address_id that has
one-to-one relationship with the address table.
PAGE 3
NORMALIZATION: Tables should be normalized till 3rd norm
Database normalization is the process of restructuring a relational database in accordance
with a series of so-called normal forms in order to reduce data redundancy and improve
data integrity. Generally, if a database is normalized until third normal form then it is
considered to be normalized. We tried to normalize the database until third normal form.
Views –
GuestsDetails – This view shows all the information about the guests.
EmployeeDetails – This view shows all the information about the employees and their
respective departments.
Triggers –
BookingAudit_OnInsert – When a new booking is generated, this trigger will create a
booking audit table and insert the data into it.
BookingAudit_OnDelete – When a booking is deleted, this trigger will be called and a row
will be inserted on the Booking Audit table with the information of the booking that is
being deleted.
CHALLENGES FACED:
We faced most of the challenges in creating relationships among tables. We need to make
sure that all the relationships created among tables are logical and follow the
normalization rules. The most challenging part was creating the booking and the rooms
table and its relationships with other respective tables.
SUMMARY:
This was an attempt to create a database management system for hotel where a DBA can
easily manage the hotels, rooms, bookings, guests, employees, departments, services, etc.
and other things as well, easily and quickly. Overall, it is huge area and we tried to cover
few of the parts of it. Thank you!
PAGE 4