Professional Documents
Culture Documents
Database Project
Hotel franchise database
Student:
Project theme
This database is created to give to the management
information about its customers , what hotel they often choose,
what services they use most often and which are the employees
who provide most services. With this information, the hotel
management can determine which are their best employees and
offer them primes, most requested services to increase the
number of employees who perform them and the most loyal
customers to offer them discounts and extra facilities.
The database is easy to use and the structure of the table
allows the user to easily obtain all this information.
Database description
One client can stay at more hotels and one hotel can have more
customers. To break the many-to-many relationship we create the
intersection entity named CLIENT.
One hotel can offer more services and one service can be offered by
more hotels. To break the many-to-many relationship we create the
intersection entity named SERVICES_CHECK.
One customer can request more services and one service can be
requested by more customers. To break the many-to-many relationship
we create the intersection entity named SERVING_CHECK.
One employee works at one hotel and one hotel can have more
employees.
Tables description
6) --Add a null type constraint for the stars_no attribute from the HOTELS
table
ALTER TABLE HOTELS
ADD CONSTRAINT stars_no_nn CHECK (stars_no is not null)
7) --Modify the dimension of the attribute adress from table HOTELS from 40
to 50.
ALTER TABLE HOTELS
MODIFY adress_hotel VARCHAR2(50)
values
values
values
values
values
values
values
values
values
values
values
values
values
values
values
values
values
values
values
values
values
values
values
values
values
id_service,utilisation_no)
id_service,utilisation_no)
id_service,utilisation_no)
id_service,utilisation_no)
id_service,utilisation_no)
id_service,utilisation_no)
id_service,utilisation_no)
id_service,utilisation_no)
id_service,utilisation_no)
id_service,utilisation_no)
id_service,utilisation_no)
id_service,utilisation_no)
id_service,utilisation_no)
id_service,utilisation_no)
id_service,utilisation_no)
id_service,utilisation_no)
id_service,utilisation_no)
id_service,utilisation_no)
id_service,utilisation_no)
id_service,utilisation_no)
id_service,utilisation_no)
id_service,utilisation_no)
id_service,utilisation_no)
id_service,utilisation_no)
id_service,utilisation_no)
id_service,utilisation_no)
id_service,utilisation_no)
id_service,utilisation_no)
id_service,utilisation_no)
id_service,utilisation_no)
id_service,utilisation_no)
id_service,utilisation_no)
id_service,utilisation_no)
id_service,utilisation_no)
id_service,utilisation_no)
id_service,utilisation_no)
id_service,utilisation_no)
id_service,utilisation_no)
id_service,utilisation_no)
id_service,utilisation_no)
id_service,utilisation_no)
id_service,utilisation_no)
id_service,utilisation_no)
id_service,utilisation_no)
id_service,utilisation_no)
id_service,utilisation_no)
Examples of interogations
Using aggregate functions, GROUP BY, HAVING
--Display the name of the customer who consumed services in
-- Display the name of the customers and the total number of services
solicitations if it was greater than 14
select c.customer_name, sum(to_number(r.utilisation_no)) as "Utilisation
times"
from customers c, serving_check r, services s
where s.id_service=r.id_service and c.customer_id=r.customer_id
group by c.customer_name
having sum(to_number(r.utilisation_no))>14
--Create an index on HOTELS table for the hotel name with the
purpose of facilitating the access to their names
create index index_hotel on hotels(name_hotel)
*delete it after
drop inder index_hotel
*delete it after
drop synonym hotel_customers
--Create a sequence with a min value of 1 and max of 55
into
into
into
into
into
into
into
into
into
into
into
into
into
HIERARCHY
HIERARCHY
HIERARCHY
HIERARCHY
HIERARCHY
HIERARCHY
HIERARCHY
HIERARCHY
HIERARCHY
HIERARCHY
HIERARCHY
HIERARCHY
HIERARCHY
from HIERARCHY
connect by prior id_employee=id_manager
start with upper(name)='MIHALCEA ANA'
--Display all employees and specify for each employee the root,