DROP TABLE BookingGuest; DROP TABLE BookingRoom; DROP TABLE Booking; DROP TABLE CleaningClerk; DROP TABLE Cleaningplan; DROP TABLE Client; DROP TABLE Clerk; DROP TABLE Person; DROP TABLE Room; DROP TABLE Adress; 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, "size" NUMBER NOT NULL, 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, CONSTRAINT fkadress FOREIGN KEY (adressId) REFERENCES Adress(adressId) ); CREATE TABLE Clerk ( personId NUMBER PRIMARY KEY, staff NUMBER NOT NULL UNIQUE, salary NUMBER NOT NULL, CONSTRAINT inheritace FOREIGN KEY (personId) REFERENCES Person(personId) ); CREATE TABLE Client ( personId NUMBER PRIMARY KEY, bankDetails VARCHAR2(22) NOT NULL, CONSTRAINT inheritace FOREIGN KEY (personId) REFERENCES Person(personId) ); CREATE TABLE Cleaningplan ( cleaningPlanId NUMBER PRIMARY KEY, --date DATE NOT NULL, duration NUMBER NOT NULL, roomNUMBER NUMBER NOT NULL, CONSTRAINT fkRoom FOREIGN KEY (roomNUMBER) REFERENCES ROOM(roomNumber) ); CREATE TABLE CleaningClerk ( clerkId NUMBER, cleaningPlanId NUMBER, CONSTRAINT pkCleaningClerk PRIMARY KEY (clerkId,cleaningPlanId), CONSTRAINT fkClerk FOREIGN KEY (clerkId) REFERENCES Clerk(personId), CONSTRAINT fkCleaningPlan FOREIGN KEY (cleaningPlanId) REFERENCES Cleaningplan(cleaningPlanId) ); CREATE TABLE Booking ( bookindId NUMBER PRIMARY KEY, arrivalDate DATE NOT NULL, departueDate DATE NULL, cost NUMBER NULL, pensionType VARCHAR2(20) NOT NULL. lateCheckout NUMBER NULL, clientId NUMBER NOT NULL, FOREIGN KEY (clientId) REFERENCES Person(personId) ); CREATE TABLE BookingGuest ( bookingId NUMBER NOT NULL, personId NUMBER NOT NULL, 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, roomNumber), FOREIGN KEY (bookingId) REFERENCES Booking(bookindId), FOREIGN KEY (roomNumber) REFERENCES Room(roomNumber) );