Commit 29be1da2 by karade

Update Andmebaasi deklaratsioon.sql

parent 737a31d3
Showing with 12 additions and 8 deletions
......@@ -6,12 +6,6 @@ CREATE TABLE `Flights`(
primary key(id)
);
CREATE TABLE `Bookings`(
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`flightNum` CHAR(255) NOT NULL,
`bookingNumber` CHAR(255) NOT NULL,
primary key(id)
);
CREATE TABLE `Users`(
`id` INT NOT NULL AUTO_INCREMENT,
......@@ -25,9 +19,19 @@ CREATE TABLE `Users`(
`seat` CHAR(255) NOT NULL,
`luggageClass` INT NOT NULL,
`flight_id` INT NOT NULL,
primary key(id)
primary key(id),
FOREIGN KEY(flight_id) REFERENCES Flights(id)
);
CREATE TABLE `Bookings`(
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`flightNum` CHAR(255) NOT NULL,
`bookingNumber` CHAR(255) NOT NULL,
`flight_id` INT NOT NULL,
`user_id` INT NOT NULL,
primary key(id),
FOREIGN KEY (user_id) REFERENCES Users(id),
FOREIGN KEY (flight_id) REFERENCES Flights(id)
);
INSERT INTO flights(destination, time, seats)
......
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