typos/sequenzen für pks

This commit is contained in:
Jan Fröse 2023-05-12 17:18:56 +02:00
parent 9c88f9b5f7
commit a94872c924

View file

@ -2,16 +2,21 @@ DROP TABLE BookingGuest;
DROP TABLE BookingRoom; DROP TABLE BookingRoom;
DROP TABLE Booking; DROP TABLE Booking;
DROP TABLE CleaningClerk; DROP TABLE CleaningClerk;
DROP TABLE Cleaningplan; DROP TABLE CleaningPlan;
DROP TABLE Client; DROP TABLE Client;
DROP TABLE Clerk; DROP TABLE Clerk;
DROP TABLE Person; DROP TABLE Person;
DROP TABLE Room; DROP TABLE Room;
DROP TABLE Adress; DROP TABLE Address;
DROP SEQUENCE address_seq;
DROP SEQUENCE room_seq;
DROP SEQUENCE person_seq;
DROP SEQUENCE cleaningPlan_seq;
DROP SEQUENCE booking_seq;
CREATE TABLE Adress CREATE TABLE Address
( (
adressId NUMBER PRIMARY KEY, addressId NUMBER PRIMARY KEY,
street VARCHAR2(50) NOT NULL, street VARCHAR2(50) NOT NULL,
houseNumber NUMBER NOT NULL, houseNumber NUMBER NOT NULL,
postalCode NUMBER NOT NULL, postalCode NUMBER NOT NULL,
@ -35,8 +40,8 @@ CREATE TABLE Person
name VARCHAR2(50) NOT NULL, name VARCHAR2(50) NOT NULL,
lastName VARCHAR2(50) NOT NULL, lastName VARCHAR2(50) NOT NULL,
age NUMBER NOT NULL, age NUMBER NOT NULL,
adressId NUMBER NOT NULL, addressId NUMBER NOT NULL,
FOREIGN KEY (adressId) REFERENCES Adress(adressId) FOREIGN KEY (addressId) REFERENCES Address(addressId)
); );
CREATE TABLE Clerk CREATE TABLE Clerk
@ -54,7 +59,7 @@ CREATE TABLE Client
FOREIGN KEY (personId) REFERENCES Person(personId) FOREIGN KEY (personId) REFERENCES Person(personId)
); );
CREATE TABLE Cleaningplan CREATE TABLE CleaningPlan
( (
cleaningPlanId NUMBER PRIMARY KEY, cleaningPlanId NUMBER PRIMARY KEY,
"date" DATE NOT NULL, "date" DATE NOT NULL,
@ -69,13 +74,13 @@ CREATE TABLE CleaningClerk
cleaningPlanId NUMBER, cleaningPlanId NUMBER,
PRIMARY KEY (clerkId,cleaningPlanId), PRIMARY KEY (clerkId,cleaningPlanId),
FOREIGN KEY (clerkId) REFERENCES Clerk(personId), FOREIGN KEY (clerkId) REFERENCES Clerk(personId),
FOREIGN KEY (cleaningPlanId) REFERENCES Cleaningplan(cleaningPlanId) FOREIGN KEY (cleaningPlanId) REFERENCES CleaningPlan(cleaningPlanId)
); );
CREATE TABLE Booking ( CREATE TABLE Booking (
bookindId NUMBER PRIMARY KEY, bookingId NUMBER PRIMARY KEY,
arrivalDate DATE NOT NULL, arrivalDate DATE NOT NULL,
departueDate DATE NULL, departureDate DATE NULL,
cost NUMBER NULL, cost NUMBER NULL,
pensionType VARCHAR2(50) NOT NULL, pensionType VARCHAR2(50) NOT NULL,
lateCheckout NUMBER NULL, lateCheckout NUMBER NULL,
@ -87,7 +92,7 @@ CREATE TABLE BookingGuest (
bookingId NUMBER NOT NULL, bookingId NUMBER NOT NULL,
personId NUMBER NOT NULL, personId NUMBER NOT NULL,
PRIMARY KEY(bookingId, personId), PRIMARY KEY(bookingId, personId),
FOREIGN KEY (bookingId) REFERENCES Booking(bookindId), FOREIGN KEY (bookingId) REFERENCES Booking(bookingId),
FOREIGN KEY (personId) REFERENCES Person(personId) FOREIGN KEY (personId) REFERENCES Person(personId)
); );
@ -95,7 +100,12 @@ CREATE TABLE BookingRoom (
bookingId NUMBER NOT NULL, bookingId NUMBER NOT NULL,
roomNumber NUMBER NOT NULL, roomNumber NUMBER NOT NULL,
PRIMARY KEY(bookingId, roomNumber), PRIMARY KEY(bookingId, roomNumber),
FOREIGN KEY (bookingId) REFERENCES Booking(bookindId), FOREIGN KEY (bookingId) REFERENCES Booking(bookingId),
FOREIGN KEY (roomNumber) REFERENCES Room(roomNumber) FOREIGN KEY (roomNumber) REFERENCES Room(roomNumber)
); );
CREATE SEQUENCE address_seq;
CREATE SEQUENCE room_seq;
CREATE SEQUENCE person_seq;
CREATE SEQUENCE cleaningPlan_seq;
CREATE SEQUENCE booking_seq;