From 72941b5ef90634d089c05f469cd761e0d7c2864a Mon Sep 17 00:00:00 2001 From: Timo Ley Date: Thu, 27 Apr 2023 15:29:39 +0000 Subject: [PATCH] add table BookingRoom --- MS1/SQL/Schema.sql | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/MS1/SQL/Schema.sql b/MS1/SQL/Schema.sql index 62961d6..b66fded 100644 --- a/MS1/SQL/Schema.sql +++ b/MS1/SQL/Schema.sql @@ -1,10 +1,11 @@ +DROP TABLE BookingGuest; +DROP TABLE BookingRoom; +DROP TABLE Booking; DROP TABLE Adress; DROP TABLE Room; DROP TABLE Person; DROP TABLE Clerk; DROP TABLE Client; -DROP TABLE Booking; - CREATE TABLE Adress ( @@ -68,4 +69,12 @@ CREATE TABLE BookingGuest ( PRIMARY KEY(bookingId, personId) FOREIGN KEY (bookingId) REFERENCES Booking(bookindId), FOREIGN KEY (personId) REFERENCES Person(personId) +); + +CREATE TABLE BookingRoom ( + bookingId NUMBER NOT NULL, + roomNumber NUMBER NOT NULL, + PRIMARY KEY(bookingId, personId) + FOREIGN KEY (bookingId) REFERENCES Booking(bookindId), + FOREIGN KEY (roomNumber) REFERENCES Room(roomNumber) ); \ No newline at end of file