Professional Documents
Culture Documents
UNIVERSITY OF TUNIS
Exercise 1:
Goal : Create and manage a database (DB) for hotel booking named “my_booking”.
Booking (id_b, #id_clt, #id_h, date_b, date_checkin, date_checkout, room, type, price);
Note: id_b is an artificial primary key in the table booking (auto increment).
Table Hotel
Table Client
CS120 1
TUNIS BUSINESS SCHOOL
UNIVERSITY OF TUNIS
Table Booking
3) Give the appropriate statement to insert data of one row for each table
CS120 2
TUNIS BUSINESS SCHOOL
UNIVERSITY OF TUNIS
4) Queries
a. Display the hotels of “Hammamet” and their categories.
b. Display the 5 stars hotels of “Djerba”.
c. Display the clients that have booked in the three star hotels of “Hammamet”.
d. Display the clients who have booked during the period of “01/07/2012” and
“22/08/2012”.
e. Display the clients living in “Tunis” and have booked in “Mahdia” hotels.
f. Display number of booking per hotel.
g. Display the total amount of booking per hotel.
h. Display the total amount of booking per city.
i. Display the total amount of booking per category.
j. Display the total amount of booking per room’s type.
Exercise 2:
Consider the following database schema GENEALOGICAL TREE:
Notice that the father, mother, husband and wife are persons.
Part 1 (DDL)
Question3: Give the SQL command allowing you to add the "WeddingDate" field of the Date type to
the UNIONS table. This table becomes:
Question4: From the following figure, give the appropriate statement to insert data of two Persons
and a weeding link of your choice.
CS120 3
TUNIS BUSINESS SCHOOL
UNIVERSITY OF TUNIS
Part 2 (DML)
Question1: Change the first name of person number 3 to "AbdelKarim" instead of his current first
name "Karim"?
Question5: Display the first name and the last name of persons how has married between
10/10/2000 and 10/10/2020.
CS120 4