2023-04-27 17:29:39 +02:00
|
|
|
DROP TABLE BookingGuest;
|
|
|
|
DROP TABLE BookingRoom;
|
|
|
|
DROP TABLE Booking;
|
2023-04-27 17:34:18 +02:00
|
|
|
DROP TABLE CleaningClerk;
|
|
|
|
DROP TABLE Cleaningplan;
|
2023-04-27 17:15:35 +02:00
|
|
|
DROP TABLE Client;
|
2023-04-27 17:34:18 +02:00
|
|
|
DROP TABLE Clerk;
|
|
|
|
DROP TABLE Person;
|
|
|
|
DROP TABLE Room;
|
|
|
|
DROP TABLE Adress;
|
2023-04-27 17:15:35 +02:00
|
|
|
|
|
|
|
CREATE TABLE Adress
|
|
|
|
(
|
|
|
|
adressId NUMBER PRIMARY KEY,
|
|
|
|
street VARCHAR2(50) NOT NULL,
|
|
|
|
houseNumber NUMBER NOT NULL,
|
|
|
|
postalCode NUMBER NOT NULL,
|
|
|
|
city VARCHAR2(50) NOT NULL,
|
|
|
|
country VARCHAR2(50) NOT NULL
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TABLE Room
|
|
|
|
(
|
|
|
|
roomNumber NUMBER PRIMARY KEY,
|
|
|
|
floor NUMBER NOT NULL,
|
|
|
|
roomTyp VARCHAR2(50) NOT NULL,
|
2023-04-27 17:34:18 +02:00
|
|
|
"size" NUMBER NOT NULL,
|
2023-04-27 17:15:35 +02:00
|
|
|
accessibility NUMBER NOT NULL,
|
|
|
|
beds NUMBER NOT NULL
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TABLE Person
|
|
|
|
(
|
|
|
|
personId NUMBER PRIMARY KEY,
|
|
|
|
name VARCHAR2(50) NOT NULL,
|
|
|
|
lastName VARCHAR2(50) NOT NULL,
|
|
|
|
age NUMBER NOT NULL,
|
|
|
|
adressId NUMBER NOT NULL,
|
2023-04-27 17:36:37 +02:00
|
|
|
FOREIGN KEY (adressId) REFERENCES Adress(adressId)
|
2023-04-27 17:15:35 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TABLE Clerk
|
|
|
|
(
|
|
|
|
personId NUMBER PRIMARY KEY,
|
|
|
|
staff NUMBER NOT NULL UNIQUE,
|
|
|
|
salary NUMBER NOT NULL,
|
2023-04-27 17:36:37 +02:00
|
|
|
FOREIGN KEY (personId) REFERENCES Person(personId)
|
2023-04-27 17:15:35 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TABLE Client
|
|
|
|
(
|
|
|
|
personId NUMBER PRIMARY KEY,
|
|
|
|
bankDetails VARCHAR2(22) NOT NULL,
|
2023-04-27 17:36:37 +02:00
|
|
|
FOREIGN KEY (personId) REFERENCES Person(personId)
|
2023-04-27 17:15:35 +02:00
|
|
|
);
|
2023-04-27 17:20:38 +02:00
|
|
|
|
2023-04-27 17:34:18 +02:00
|
|
|
CREATE TABLE Cleaningplan
|
|
|
|
(
|
|
|
|
cleaningPlanId NUMBER PRIMARY KEY,
|
2023-04-27 18:03:36 +02:00
|
|
|
"date" DATE NOT NULL,
|
2023-04-27 17:34:18 +02:00
|
|
|
duration NUMBER NOT NULL,
|
|
|
|
roomNUMBER NUMBER NOT NULL,
|
2023-04-27 17:36:37 +02:00
|
|
|
FOREIGN KEY (roomNUMBER) REFERENCES ROOM(roomNumber)
|
2023-04-27 17:34:18 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TABLE CleaningClerk
|
|
|
|
(
|
|
|
|
clerkId NUMBER,
|
|
|
|
cleaningPlanId NUMBER,
|
2023-04-27 17:36:37 +02:00
|
|
|
PRIMARY KEY (clerkId,cleaningPlanId),
|
|
|
|
FOREIGN KEY (clerkId) REFERENCES Clerk(personId),
|
|
|
|
FOREIGN KEY (cleaningPlanId) REFERENCES Cleaningplan(cleaningPlanId)
|
2023-04-27 17:34:18 +02:00
|
|
|
);
|
|
|
|
|
2023-04-27 17:20:38 +02:00
|
|
|
CREATE TABLE Booking (
|
|
|
|
bookindId NUMBER PRIMARY KEY,
|
|
|
|
arrivalDate DATE NOT NULL,
|
|
|
|
departueDate DATE NULL,
|
|
|
|
cost NUMBER NULL,
|
2023-04-27 18:09:06 +02:00
|
|
|
pensionType VARCHAR2(50) NOT NULL,
|
2023-04-27 17:20:38 +02:00
|
|
|
lateCheckout NUMBER NULL,
|
|
|
|
clientId NUMBER NOT NULL,
|
2023-04-27 17:56:22 +02:00
|
|
|
FOREIGN KEY (clientId) REFERENCES Client(personId)
|
2023-04-27 17:20:38 +02:00
|
|
|
);
|
2023-04-27 17:27:30 +02:00
|
|
|
|
|
|
|
CREATE TABLE BookingGuest (
|
|
|
|
bookingId NUMBER NOT NULL,
|
|
|
|
personId NUMBER NOT NULL,
|
2023-04-27 17:34:18 +02:00
|
|
|
PRIMARY KEY(bookingId, personId),
|
2023-04-27 17:27:30 +02:00
|
|
|
FOREIGN KEY (bookingId) REFERENCES Booking(bookindId),
|
|
|
|
FOREIGN KEY (personId) REFERENCES Person(personId)
|
2023-04-27 17:29:39 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TABLE BookingRoom (
|
|
|
|
bookingId NUMBER NOT NULL,
|
|
|
|
roomNumber NUMBER NOT NULL,
|
2023-04-27 17:34:18 +02:00
|
|
|
PRIMARY KEY(bookingId, roomNumber),
|
2023-04-27 17:29:39 +02:00
|
|
|
FOREIGN KEY (bookingId) REFERENCES Booking(bookindId),
|
|
|
|
FOREIGN KEY (roomNumber) REFERENCES Room(roomNumber)
|
2023-05-12 16:52:59 +02:00
|
|
|
);
|
|
|
|
|