Projecthotel
Projecthotel
2023
PROJECT
DATABASE
DONE BY
- Saleem Hamed Ahmed -Amjad Abdulhakim
-Ayman Abdullah Faed - Azzam Mohmmed
-Basel Anwar Alathuri
them together. We write the some main entities to avoid redundancy data . we define Entity person that
some attributes that determines all one of them. Also they connecting with person many to to one and
the entity address has (address_id,address_name,…), the employee entity connecting with use entity in
inherint , the user entity has attribute( use_id,user_datacreated,…..user_login), the employee connecting
with the hotal(hotal_address,hotal_name,…) entity many to one .the customer entity connecting with
attributes(reservation_id,reservation_name,reservation_date,reservation_....)and reservationList
contains attributes(service_id ,service_name,…).the service inherints to room entity and wing entity .
Employee IS A Person
Employee Hotel
Work on
Person Address
Has A
Entity:Reservation, Payment
Relationship: A Reservation includes Payment.
primary - User_id
foreign key:
Wing_id
Part 4:
Physical Model (Mapping)
1. Convert the logical model to a physical model using a table format (not implementation)
Entity Type:User
Attribute Data Type Required
User_id Integer (10) PK-Yes
Fk_Yes
Type_user Varchar2(50) Yes
User_powerGrant Varchar2(50) Yes
User_dateCreate Date Yes
user_email Varchar2(50) Yes
User_login Varchar2(50) Yes
Table created.
SQL>
SQL> create table wing(wing_id number(7) ,
3 constraint wing_id_pk primary key( wing_id));
Table created.
SQL>
SQL> create table users(user_id number(7) ,
4 User_powerGrant Varchar2(50) not null,
5 User_dateCreate date default(sysdate),
6 User_login Varchar2(50) not null,
7 constraint users_id_pk primary key( user_id));
Table created.
SQL> create table Address(Addres_id number(7) ,
Table created.
SQL>
SQL> create table Discount(Dis_id number(7) ,
2 bill_number number(7) not null,
3 Discount_name Varchar2(50) not null,
4 Discount_description Varchar2(50) not null,
5 Start_date date default(sysdate),
SQL>
SQL> create table ReservationList(Reserli_id number(7) ,
2 Reserve_id number(7) not null,
3 Cust_id number(7) not null,
4 Reserli_name Varchar2(50) not null,
5 Reserve_date date default(sysdate),
6 Reserve_state Varchar2(50) not null,
7 constraint ReservationList_id_pk primary key(Reserli_id));
Table created.
Table created.
SQL> alter table Reservations add constraint Reservations_id_fk foreign key(Service_id)references
Services(Service_id)on delete cascade;
2 phone_number number(20) ,
3 constraint phone_phon_id_fk foreign key(phon_id)references person(per_id) on delete
cascade);
Table created.
Table altered.
SQL> alter table address add constraint address_PER_ID_fk foreign key( PER_ID) references
person(PER_ID) on delete cascade;
Table altered.
SQL> alter table payment add constraint payment_bill_ID_fk foreign key( bill_ID) references
bills(BILL_ID) on delete cascade;
Table altered.
SQL>
Table altered..
SQL> alter table users add constraint users_type_ID_fk foreign key(type_ID) references type(type_ID)
on delete cascade;
Table altered.
SQL>
SQL> alter table person add constraint person_contact_ID_fk foreign key(CONTACT_ID) references
CONTACACTINFO(CONTAC_ID) on delete cascade;
Table altered.
SQL> alter table employee add constraint employee_per_id foreign key(emp_id) references
person(per_id) on delete cascade;
Table altered.
SQL>
SQL> alter table customer add constraint customer_cust_id foreign key(cust_id) references
person(per_id) on delete cascade;
Table altered.
Table altered.
SQL>
Table altered.
SQL> alter table room add constraint room_room_id_fk foreign key(room_id) references
SERVICES(SERVICE_id) on delete c=ascade;
Table altered.
SQL>
SQL> alter table wing add constraint wing_wing_id_fk foreign key(wing_id) references
SERVICES(SERVICE_id) on delete cascade; Table altered.
SQL> alter table hotel add constraint hotel_SERVICE_ID_fk foreign key(SERVICE_ID) references
SERVICES(SERVICE_ID) on delete cascade ;
Table altered.
SQL> alter table hotel add constraint hotel_RESERLI_ID_fk foreign key(RESERLI_ID) references
RESERVATIONLIST(RESERLI_ID) on delete cascade ;
Table altered.
SQL>
Table altered.
SQL>
Table altered.