Commit d3906abf by karade

Update Andmebaasi deklaratsioon.sql

parent 1db0bfd9
Showing with 3 additions and 8 deletions
...@@ -4,19 +4,12 @@ CREATE TABLE `Flights`( ...@@ -4,19 +4,12 @@ CREATE TABLE `Flights`(
`seats` INT NOT NULL, `seats` INT NOT NULL,
primary key(destination) primary key(destination)
); );
CREATE TABLE `Bookings`( CREATE TABLE `Bookings`(
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
`seat` INT NOT NULL,
`flightNum` CHAR(255) NOT NULL, `flightNum` CHAR(255) NOT NULL,
`bookingNumber` BIGINT NOT NULL, `bookingNumber` BIGINT NOT NULL,
`luggageClass` INT NULL COMMENT '1-With check-in
2-Oversized
3-Other',
`checkedIn` TINYINT(1) NOT NULL,
primary key(id) primary key(id)
); );
CREATE TABLE `Users`( CREATE TABLE `Users`(
`documentNum` BIGINT NOT NULL, `documentNum` BIGINT NOT NULL,
`firstName` CHAR(255) NULL, `firstName` CHAR(255) NULL,
...@@ -24,6 +17,9 @@ CREATE TABLE `Users`( ...@@ -24,6 +17,9 @@ CREATE TABLE `Users`(
`dateOfBirth` CHAR(255) NULL, `dateOfBirth` CHAR(255) NULL,
`email` CHAR(255) NULL, `email` CHAR(255) NULL,
`residency` CHAR(255) NULL, `residency` CHAR(255) NULL,
`checkedIn` TINYINT(1) NOT NULL,
`seat` CHAR(255) NOT NULL,
`luggageClass` INT NOT NULL,
primary key(documentNum) primary key(documentNum)
); );
...@@ -32,7 +28,6 @@ ALTER TABLE ...@@ -32,7 +28,6 @@ ALTER TABLE
ALTER TABLE ALTER TABLE
`Bookings` ADD CONSTRAINT `bookings_bookingnumber_foreign` FOREIGN KEY(`bookingNumber`) REFERENCES `Users`(`documentNum`); `Bookings` ADD CONSTRAINT `bookings_bookingnumber_foreign` FOREIGN KEY(`bookingNumber`) REFERENCES `Users`(`documentNum`);
INSERT INTO flights(destination, time, seats) INSERT INTO flights(destination, time, seats)
VALUES VALUES
("Helsinki", "050950JUN23", 72), ("Helsinki", "050950JUN23", 72),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment