Skip to content
  • P
    Projects
  • G
    Groups
  • S
    Snippets
  • Help

krmaet / Lennubroneerimis_tarkvara

  • This project
    • Loading...
  • Sign in
Go to a project
  • Project
  • Repository
  • Pipelines
  • Members
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Commits
  • Issue Boards
  • Files
  • Commits
  • Branches
  • Tags
  • Contributors
  • Graph
  • Compare
  • Charts
Commit 29be1da2 authored 2 years ago by karade's avatar karade
Browse files
Options
  • Browse Files
  • Download
  • Email Patches
  • Plain Diff

Update Andmebaasi deklaratsioon.sql

parent 737a31d3
Hide whitespace changes
Inline Side-by-side
Showing with 14 additions and 9 deletions
  • Andmebaasi deklaratsioon.sql
Andmebaasi deklaratsioon.sql
View file @ 29be1da2
......@@ -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)
......@@ -36,4 +40,4 @@ VALUES
("Kuressaare", "021440JUN23", 72),
("Kardla", "081700JUN23", 72),
("Stockholm", "071230JUN23", 72),
("Riga", "122200JUN23", 72);
("Riga", "122200JUN23", 72);
\ No newline at end of file
This diff is collapsed. Click to expand it.
  • Write
  • Preview
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