Booking table contains data about the booking made for rooms.. The primary key for this table is booking _id Cee § booking_ID restaurant_ID client_Phone table_Number service_ID bookin
Trang 1VIETNAM NATIONAL UNIVERSITY INTERNATIONAL SCHOOL -000 -
FINAL EXAMINATION
Big Assignment Course Title: DATABASES
Course Code: INS208001
Group: 1 — Restaurant Management System
Leader: Phan Gia Bao - 21070849
Member: Déng Thi Hoa - 21070894
Đỗ Ngọc Tién - 21070775
Vũ Đức Việt- 21070088
Total mark (written in number):
Total mark (written in words):
Marker’s signature:
Trang 2Table of content
1 INTRODUCTION 3
L Brief information Of QrOUP 00 ccc cc ccc ốee.<a 3 VN/1,:28./71/0x //,.8)8.15//.).000nnn0n0080 6 3
III Defined tables: Design the tables, column and relationship - 6
IV WRLTING QUERIES AND TRIGGERS AND VIEWS:, ssx 10
ID vL.(2/0()00)((1-::ddÄỒIẰIẰẮẶA 10
3 View details of all empÌÏoyees - - - G G0000 1111111111 1111k s1 ky sea 10
4 View details of aÏÏ øuesfs - - QC 22 1122211112221 111181211112 1 11852211111 tre 10
5 How many distinct guest have made bookings for a particular month?
Trang 3
* INTRODUCTION
* Brief information of group
Group’s Name: Group Ì
Topic: Database Management System
Mentor: Mr Nguyén Dinh Tran Long, VNU-International School course’s lecturer
of Database
Progression: With the guidance from Mr Long, we developed the project to
calculate the fees and salaries for the school's students and teachers or staff From the lessons of Database, we learned how to use functions to write this project Finally, after working together as a team and the advice from our lecturer, we have improved our project and combined our results in this report
2 Brief information of the project
In developed countries, the hotel and restaurant industry has developed very strongly and has high profits because of the support of IT In our country in recent years, the tourism industry has really developed in terms of scale as well as its impact on socio- economic fields However, the application of IT In the industry 1s still limited, so the application of IT in the restaurant management program for the tourism industry is extremely necessary to improve business efficiency and quality
Restaurant management is a very complex business, requiring a massive
management system Within the framework of this large exercise, we will dive into creating a database management system for a restaurant
The restaurant can have multiple chains, which can further have multiple restaurants Therefore, we need an organized management system, which can easily manage all the operations and data of the restaurant chains and restaurants respectively including:
- The restaurant chains, and their details
- The restaurants in each chain and their details and other information like the rooms and their description and discounts, etc
- Information about employees and departments they work in
- Information about guests
- Managing bookings and other services used by the clients
Trang 4Il DATABASE DESIGNING
Starting with designing the structure of the database, we have drawn ERD Sketch of how restaurant management data is organized to record all necessary data types in an easy and straightforward way The diagram 1s generated as follows:
Table_type
Trang 5After plotting the related ERD we convert it to the corresponding Relational Schema
doh Has Ingredients
“ ðe————I
‡ ì
oe table Type
— reat
III Defined tables: Design the tables, column and relationship
We started with designing the structure of the database We drew the ERD diagram
on paper, noting down all the tables required We designed each table with columns and attributes respectively I have designed the below tables:
Trang 6Booking table contains data about the booking made for rooms The primary key for this table is booking _id
Cee
§ booking_ID
restaurant_ID client_Phone table_Number service_ID
booking_Description date_Booking deposit booking_Cost
The table has the following foreign keys:
Restaurant _restaurant_id(FK1) which has a one or more-to-one and only one relationship with the Payment table
Client _ClientPhone(FK2) which has a one or more-to-one and only one relationship with the Payment table
Service table contains info about the services Primary key for this table is service_id
service_Name service_Cost
ServiceUsed table contains info about the services used by clients Primary key for this table is Service _Used_ID
service_ID
client_Phone
Client table has the data about the clients that the food is ordered The primary key of this table is client_Phone which has zero or many-to-one to one relationship with ServiceUsed table
Trang 7Restaurant Restaurant ID(FK1) which has one or more-to-zero or many relationship with Restaurant table
$ client Phone
restaurant_ID client_Name client_Email client_Standard
The primary key of Payment table is payment_id The foreign keys are
Restaurant_restaurant_id and client_clientphone which both relates to Order table The primary key of Order table -OrderID 1s the third foreign key in payment table
FSi
@ payment_ID
restaurant_ID client_Phone order_ID
booking_ID
discount_ID
payment_Cost payment_Date
restaurant_ID client_Phone table_Number service_ID date_Order order_Cost
The primary key in Discount table 1s DiscountID which has many-to-many
relationship with Payment table
Trang 8
amount start_Time end_Time standard
Employee : The employee table contains details on the various employee and department The primary key,emp_ id, creates a one or more-to-one and only one relationship with the department table
restaurant_ID
emp_Name
department_ID
emp_Phone
position
salary
department1
ÿ department_ID
department_Name
Restaurant table has the data about the information of the restaurant The primary key is Restaurant_ID and one foreign key: RestaurantChain_ChainNumber which has many to many relationship with the RestaurantChain
@ restaurant_ID
chain_ID
phone_Contact
store_Email
describe
pagee
open_Time
close_Time
address1
Trang 9Restaurant chain table contains data about the information of the restaurant chain The primary key of this table 1s chain_id
restaurant chain
website
Header table has a primary key namely header_id, which 1s the second foreign key in header work table
header_work
header_ID
Response table provide feedback after using the food at the restaurant from client table Res_Id is the primary key of this table
$ res ID
restaurant_ID client_Phone response
rating_Star
Rating table has one primary key 1s ratingstar create a relationship with a response table
rating
TableType table contains the type of tables that client opt for their meals Type_Id is
a primary key which has one and only one-to-one or more relationship with table table
Table table has two foreign keys:tabletype_tabletype_id; Restaurant restaurant 1d which connect directly to restaurant table
Trang 10
restaurant_ID
type_ID
Normalization: Tables should be normalized till 3rd norm
In order to eliminate data redundancy and increase data integrity, a relational database is restructured in line with a number of so-called normal forms A database is often regarded as normalized if it has been normalized up to the third normal form Up until the third normal form, we attempted to normalize the database
IV WRITING QUERIES AND TRIGGERS AND VIEWS:
Writing down the queries was the easiest part for us As we put a lot of effort in designing the database and creating relationships in a manner that, 1t will be easier to fetch the data from two or more tables We wrote the queries as per the requirements and check in twice with valid as well as invalid data
1 Trigger for insert
For revenue to exceed depreciation expense, the total amout greater or equal 100 Hence, we use TRIGGER, DECLARE, INSERT, FOR, INSERT, FROM, WHERE, IF, PRINT, ROLLBACK TRAN to create Trigger not to insert total amount smaller 100 When we try to insert a booking that have the total amount smaller than 200, the system will print “Cant insert tenant with booking Cost < 100”
2 Trigger for booking limit
The restaurant may no longer have available seats for customers to make
reservations Hence, we use TRIGGER, ON, FOR, DELETE, DECLARE, INT, SELECT, COUNT, FROM, GROUP BY, HAVING, IF, PRINT, ROLLBACK TRAN to creat Trigger to limit booking When we limit to clients, system will print
“The booking limit for this customer has been reached Please try again later”
3 View details of all employees
We use VIEW, SELECT, FROM, JOIN, ON to connect table employees and department to take information from them Then, we create a view to show all information of employees
4 View details of all guests
We use VIEW, SELECT, FROM, JOIN, ON, WHERE, DISTINCT to create a view
to show all information of clients
5 How many distinct guest have made bookings for a particular month?
10
Trang 11We use SELECT, FROM to show the distinct clients have made bookings for a particular month
V 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
VI SUMMARY:
This was an attempt to create a database management system for hotel where a DBA can easily manage the restaurant, table, bookings, clients, 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
VIL INDIVIDUAL CONTRIBUTION:
1 | Phan Gia Bảo 21070849 * Navigate to ERD and relation schema
* Test and fix bugs of team member codes
* Check and revise the report Guide team members to code their own work
2 | Dong Thi Hoa | 21070894 * Coder
* Create tables and attributes in database
« Draw ERD
Check and revise the final report
Tien * Create primary key and foreign key
* Check and revise the final report
4 | Vũ Đức Việt 21070088 * Do report
* Check and revise the final report
11