Commit ef4d6829 by karade

Update Andmebaasi deklaratsioon.sql

parent f06e0dbc
Showing with 7 additions and 4 deletions
CREATE TABLE `Flights`( CREATE TABLE `Flights`(
`destination` CHAR(255) NOT NULL, `destination` CHAR(255) NOT NULL,
`time` BIGINT NOT NULL, `time` CHAR(255) NOT NULL,
`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, `seat` INT NOT NULL,
...@@ -13,8 +14,9 @@ CREATE TABLE `Bookings`( ...@@ -13,8 +14,9 @@ CREATE TABLE `Bookings`(
2-Oversized 2-Oversized
3-Other', 3-Other',
`checkedIn` TINYINT(1) NOT NULL, `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,
...@@ -22,8 +24,9 @@ CREATE TABLE `Users`( ...@@ -22,8 +24,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,
primary key (documentNum) primary key(documentNum)
); );
ALTER TABLE ALTER TABLE
`Bookings` ADD CONSTRAINT `bookings_flightnum_foreign` FOREIGN KEY(`flightNum`) REFERENCES `Flights`(`destination`); `Bookings` ADD CONSTRAINT `bookings_flightnum_foreign` FOREIGN KEY(`flightNum`) REFERENCES `Flights`(`destination`);
ALTER TABLE ALTER TABLE
......
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