typos/sequenzen für pks
This commit is contained in:
parent
9c88f9b5f7
commit
a94872c924
1 changed files with 22 additions and 12 deletions
|
@ -2,16 +2,21 @@ DROP TABLE BookingGuest;
|
|||
DROP TABLE BookingRoom;
|
||||
DROP TABLE Booking;
|
||||
DROP TABLE CleaningClerk;
|
||||
DROP TABLE Cleaningplan;
|
||||
DROP TABLE CleaningPlan;
|
||||
DROP TABLE Client;
|
||||
DROP TABLE Clerk;
|
||||
DROP TABLE Person;
|
||||
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,
|
||||
houseNumber NUMBER NOT NULL,
|
||||
postalCode NUMBER NOT NULL,
|
||||
|
@ -35,8 +40,8 @@ CREATE TABLE Person
|
|||
name VARCHAR2(50) NOT NULL,
|
||||
lastName VARCHAR2(50) NOT NULL,
|
||||
age NUMBER NOT NULL,
|
||||
adressId NUMBER NOT NULL,
|
||||
FOREIGN KEY (adressId) REFERENCES Adress(adressId)
|
||||
addressId NUMBER NOT NULL,
|
||||
FOREIGN KEY (addressId) REFERENCES Address(addressId)
|
||||
);
|
||||
|
||||
CREATE TABLE Clerk
|
||||
|
@ -54,7 +59,7 @@ CREATE TABLE Client
|
|||
FOREIGN KEY (personId) REFERENCES Person(personId)
|
||||
);
|
||||
|
||||
CREATE TABLE Cleaningplan
|
||||
CREATE TABLE CleaningPlan
|
||||
(
|
||||
cleaningPlanId NUMBER PRIMARY KEY,
|
||||
"date" DATE NOT NULL,
|
||||
|
@ -69,13 +74,13 @@ CREATE TABLE CleaningClerk
|
|||
cleaningPlanId NUMBER,
|
||||
PRIMARY KEY (clerkId,cleaningPlanId),
|
||||
FOREIGN KEY (clerkId) REFERENCES Clerk(personId),
|
||||
FOREIGN KEY (cleaningPlanId) REFERENCES Cleaningplan(cleaningPlanId)
|
||||
FOREIGN KEY (cleaningPlanId) REFERENCES CleaningPlan(cleaningPlanId)
|
||||
);
|
||||
|
||||
CREATE TABLE Booking (
|
||||
bookindId NUMBER PRIMARY KEY,
|
||||
bookingId NUMBER PRIMARY KEY,
|
||||
arrivalDate DATE NOT NULL,
|
||||
departueDate DATE NULL,
|
||||
departureDate DATE NULL,
|
||||
cost NUMBER NULL,
|
||||
pensionType VARCHAR2(50) NOT NULL,
|
||||
lateCheckout NUMBER NULL,
|
||||
|
@ -87,7 +92,7 @@ CREATE TABLE BookingGuest (
|
|||
bookingId NUMBER NOT NULL,
|
||||
personId NUMBER NOT NULL,
|
||||
PRIMARY KEY(bookingId, personId),
|
||||
FOREIGN KEY (bookingId) REFERENCES Booking(bookindId),
|
||||
FOREIGN KEY (bookingId) REFERENCES Booking(bookingId),
|
||||
FOREIGN KEY (personId) REFERENCES Person(personId)
|
||||
);
|
||||
|
||||
|
@ -95,7 +100,12 @@ CREATE TABLE BookingRoom (
|
|||
bookingId NUMBER NOT NULL,
|
||||
roomNumber NUMBER NOT NULL,
|
||||
PRIMARY KEY(bookingId, roomNumber),
|
||||
FOREIGN KEY (bookingId) REFERENCES Booking(bookindId),
|
||||
FOREIGN KEY (bookingId) REFERENCES Booking(bookingId),
|
||||
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;
|
Loading…
Reference in a new issue