Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DROP TABLE Room;
- DROP TABLE Guest;
- DROP TABLE Category;
- DROP TABLE Reservation;
- CREATE TABLE Guest (IdGuest INTEGER PRIMARY KEY, Name VARCHAR2(20) NOT NULL, Surname VARCHAR2(30) NOT NULL, Discount INTEGER NULL);
- CREATE TABLE Category (IdCategory INTEGER PRIMARY KEY, Name VARCHAR2(20) NOT NULL, Price NUMERIC(8,2) NOT NULL);
- CREATE TABLE Room (RoomNumber INTEGER PRIMARY KEY, IdCategory INTEGER NOT NULL REFERENCES Category ON DELETE CASCADE, Capacity INTEGER NOT NULL);
- CREATE TABLE Reservation (IdReservation INTEGER PRIMARY KEY, DateStart DATE NOT NULL, DateEnd DATE NOT NULL, IdGuest INTEGER NOT NULL REFERENCES Guest ON DELETE CASCADE, RoomNumber INTEGER NOT NULL REFERENCES Room ON DELETE CASCADE, Paid INTEGER NOT NULL);
- INSERT INTO Guest (IdGuest, Name, Surname, Discount) VALUES (1, 'Anna', 'White', 20);
- INSERT INTO Guest (IdGuest, Name, Surname, Discount) VALUES (2, 'John', 'Black', NULL);
- INSERT INTO Guest (IdGuest, Name, Surname, Discount) VALUES (3, 'Mike', 'Green', 10);
- INSERT INTO Guest (IdGuest, Name, Surname, Discount) VALUES (4, 'Ivy', 'Blue', 30);
- INSERT INTO Guest (IdGuest, Name, Surname, Discount) VALUES (5, 'Monica', 'Gray', NULL);
- INSERT INTO Guest (IdGuest, Name, Surname, Discount) VALUES (6, 'Jack', 'Blue', 5);
- INSERT INTO Guest (IdGuest, Name, Surname, Discount) VALUES (7, 'Nick', 'Yellow', 15);
- INSERT INTO Guest (IdGuest, Name, Surname, Discount) VALUES (8, 'Edward', 'Purple', 20);
- INSERT INTO Guest (IdGuest, Name, Surname, Discount) VALUES (9, 'Helena', 'Pink', NULL);
- INSERT INTO Guest (IdGuest, Name, Surname, Discount) VALUES (10, 'Sarah', 'Red', 20);
- INSERT INTO Category (IdCategory, Name, Price) VALUES (1, 'Turistic', 30);
- INSERT INTO Category (IdCategory, Name, Price) VALUES (2, 'Standard', 60);
- INSERT INTO Category (IdCategory, Name, Price) VALUES (3, 'Luxurious', 120);
- INSERT INTO Room (RoomNumber, IdCategory, Capacity) VALUES (101, 1, 2);
- INSERT INTO Room (RoomNumber, IdCategory, Capacity) VALUES (102, 1, 2);
- INSERT INTO Room (RoomNumber, IdCategory, Capacity) VALUES (103, 1, 3);
- INSERT INTO Room (RoomNumber, IdCategory, Capacity) VALUES (104, 2, 2);
- INSERT INTO Room (RoomNumber, IdCategory, Capacity) VALUES (105, 2, 2);
- INSERT INTO Room (RoomNumber, IdCategory, Capacity) VALUES (201, 1, 2);
- INSERT INTO Room (RoomNumber, IdCategory, Capacity) VALUES (202, 3, 4);
- INSERT INTO Room (RoomNumber, IdCategory, Capacity) VALUES (203, 3, 2);
- INSERT INTO Room (RoomNumber, IdCategory, Capacity) VALUES (204, 3, 2);
- INSERT INTO Room (RoomNumber, IdCategory, Capacity) VALUES (205, 2, 3);
- INSERT INTO Reservation (IdReservation, DateStart, DateEnd, IdGuest, RoomNumber, Paid) VALUES (1, TO_DATE('2009-07-01','yyyy-mm-dd'), TO_DATE('2009-07-05','yyyy-mm-dd'), 1, 101, 1);
- INSERT INTO Reservation (IdReservation, DateStart, DateEnd, IdGuest, RoomNumber, Paid) VALUES (2, TO_DATE('2008-01-03','yyyy-mm-dd'), TO_DATE('2008-01-15','yyyy-mm-dd'), 1, 102, 1);
- INSERT INTO Reservation (IdReservation, DateStart, DateEnd, IdGuest, RoomNumber, Paid) VALUES (3, TO_DATE('2009-07-15','yyyy-mm-dd'), TO_DATE('2009-08-02','yyyy-mm-dd'), 2, 101, 1);
- INSERT INTO Reservation (IdReservation, DateStart, DateEnd, IdGuest, RoomNumber, Paid) VALUES (4, TO_DATE('2008-12-12','yyyy-mm-dd'), TO_DATE('2008-12-14','yyyy-mm-dd'), 3, 103, 1);
- INSERT INTO Reservation (IdReservation, DateStart, DateEnd, IdGuest, RoomNumber, Paid) VALUES (5, TO_DATE('2009-05-01','yyyy-mm-dd'), TO_DATE('2009-05-05','yyyy-mm-dd'), 3, 201, 1);
- INSERT INTO Reservation (IdReservation, DateStart, DateEnd, IdGuest, RoomNumber, Paid) VALUES (6, TO_DATE('2009-04-01','yyyy-mm-dd'), TO_DATE('2009-05-01','yyyy-mm-dd'), 4, 201, 0);
- INSERT INTO Reservation (IdReservation, DateStart, DateEnd, IdGuest, RoomNumber, Paid) VALUES (7, TO_DATE('2008-11-15','yyyy-mm-dd'), TO_DATE('2008-11-20','yyyy-mm-dd'), 4, 105, 0);
- INSERT INTO Reservation (IdReservation, DateStart, DateEnd, IdGuest, RoomNumber, Paid) VALUES (8, TO_DATE('2009-10-01','yyyy-mm-dd'), TO_DATE('2009-10-07','yyyy-mm-dd'), 10, 104, 1);
- INSERT INTO Reservation (IdReservation, DateStart, DateEnd, IdGuest, RoomNumber, Paid) VALUES (9, TO_DATE('2009-07-03','yyyy-mm-dd'), TO_DATE('2009-07-20','yyyy-mm-dd'), 10, 204, 1);
- INSERT INTO Reservation (IdReservation, DateStart, DateEnd, IdGuest, RoomNumber, Paid) VALUES (10, TO_DATE('2009-03-12','yyyy-mm-dd'), TO_DATE('2009-03-20','yyyy-mm-dd'), 9, 201, 1);
- INSERT INTO Reservation (IdReservation, DateStart, DateEnd, IdGuest, RoomNumber, Paid) VALUES (11, TO_DATE('2009-12-01','yyyy-mm-dd'), TO_DATE('2009-12-02','yyyy-mm-dd'), 9, 202, 1);
- INSERT INTO Reservation (IdReservation, DateStart, DateEnd, IdGuest, RoomNumber, Paid) VALUES (12, TO_DATE('2009-12-01','yyyy-mm-dd'), TO_DATE('2009-12-10','yyyy-mm-dd'), 8, 202, 1);
- INSERT INTO Reservation (IdReservation, DateStart, DateEnd, IdGuest, RoomNumber, Paid) VALUES (13, TO_DATE('2008-03-03','yyyy-mm-dd'), TO_DATE('2008-03-12','yyyy-mm-dd'), 1, 203, 0);
- INSERT INTO Reservation (IdReservation, DateStart, DateEnd, IdGuest, RoomNumber, Paid) VALUES (14, TO_DATE('2009-08-25','yyyy-mm-dd'), TO_DATE('2009-09-01','yyyy-mm-dd'), 6, 205, 1);
- INSERT INTO Reservation (IdReservation, DateStart, DateEnd, IdGuest, RoomNumber, Paid) VALUES (15, TO_DATE('2009-04-16','yyyy-mm-dd'), TO_DATE('2009-04-21','yyyy-mm-dd'), 6, 101, 0);
- INSERT INTO Reservation (IdReservation, DateStart, DateEnd, IdGuest, RoomNumber, Paid) VALUES (16, TO_DATE('2009-04-17','yyyy-mm-dd'), TO_DATE('2009-04-20','yyyy-mm-dd'), 6, 105, 1);
- INSERT INTO Reservation (IdReservation, DateStart, DateEnd, IdGuest, RoomNumber, Paid) VALUES (17, TO_DATE('2009-02-12','yyyy-mm-dd'), TO_DATE('2009-02-14','yyyy-mm-dd'), 5, 104, 1);
- INSERT INTO Reservation (IdReservation, DateStart, DateEnd, IdGuest, RoomNumber, Paid) VALUES (18, TO_DATE('2008-11-10','yyyy-mm-dd'), TO_DATE('2008-11-20','yyyy-mm-dd'), 1, 103, 1);
- INSERT INTO Reservation (IdReservation, DateStart, DateEnd, IdGuest, RoomNumber, Paid) VALUES (19, TO_DATE('2009-06-07','yyyy-mm-dd'), TO_DATE('2009-06-15','yyyy-mm-dd'), 2, 101, 1);
- INSERT INTO Reservation (IdReservation, DateStart, DateEnd, IdGuest, RoomNumber, Paid) VALUES (20, TO_DATE('2009-07-01','yyyy-mm-dd'), TO_DATE('2009-07-05','yyyy-mm-dd'), 3, 101, 1);
- COMMIT
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement