· 7 years ago · Dec 05, 2018, 12:30 PM
1//a)
2
3CREATE DATABASE hotelReservationSystem;
4
5CREATE TABLE IF NOT EXISTS Hotels (
6 hotel_id int NOT NULL PRIMARY KEY,
7 hotel_name varchar(255) NOT NULL,
8 hotel_city varchar(255) NOT NULL,
9 hotel_address varchar(255) NOT NULL,
10 hotel_id int FOREIGN KEY REFERENCES Clients(client_id)
11 hotel_id int FOREIGN KEY REFERENCES Clients(client_id)
12);
13
14CREATE TABLE IF NOT EXISTS Clients (
15 client_id int NOT NULL PRIMARY KEY,
16 client_firstname varchar(255) NOT NULL,
17 client_lastname varchar(255) NOT NULL,
18 client_birthday varchar(255) NOT NULL,
19 client_email varchar(255) NOT NULL,
20 client_id int FOREIGN KEY REFERENCES Hotels(hotel_id)
21 client_id int FOREIGN KEY REFERENCES Reservations(reservation_id)
22);
23
24CREATE TABLE IF NOT EXISTS Reservations (
25 reservation_id int NOT NULL PRIMARY KEY,
26 reservation_date DATETIME NOT NULL
27 client_email varchar(255) NOT NULL,
28 paid_amount varchar(255) NOT NULL,
29 date_accommodation DATETIME NOT NULL,
30 date_leaving DATETIME NOT NULL,
31 reservation_id int FOREIGN KEY REFERENCES Clients(client_id)
32 reservation_id int FOREIGN KEY REFERENCES Hotels(hotel_id)
33);