Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
krmaet
/
Lennubroneerimis_tarkvara
This project
Loading...
Sign in
Toggle navigation
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
db683276
authored
Mar 17, 2023
by
karade
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update Andmebaasi deklaratsioon.sql
parent
9eea3935
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
10 deletions
Andmebaasi deklaratsioon.sql
Andmebaasi deklaratsioon.sql
View file @
db683276
CREATE
TABLE
`Flights`
(
CREATE
TABLE
`Flights`
(
`id`
INT
NOT
NULL
AUTO_INCREMENT
,
`passenger_id`
INT
NOT
NULL
,
`destination`
CHAR
(
255
)
NOT
NULL
,
`destination`
CHAR
(
255
)
NOT
NULL
,
`time`
CHAR
(
255
)
NOT
NULL
,
`time`
CHAR
(
255
)
NOT
NULL
,
`seats`
INT
NOT
NULL
,
`seats`
INT
NOT
NULL
,
primary
key
(
destination
)
primary
key
(
id
)
);
);
CREATE
TABLE
`Bookings`
(
CREATE
TABLE
`Bookings`
(
`id`
BIG
INT
UNSIGNED
NOT
NULL
AUTO_INCREMENT
,
`id`
INT
UNSIGNED
NOT
NULL
AUTO_INCREMENT
,
`flightNum`
CHAR
(
255
)
NOT
NULL
,
`flightNum`
CHAR
(
255
)
NOT
NULL
,
`bookingNumber`
BIGINT
NOT
NULL
,
`bookingNumber`
CHAR
(
255
)
NOT
NULL
,
primary
key
(
id
)
primary
key
(
id
)
);
);
CREATE
TABLE
`Users`
(
CREATE
TABLE
`Users`
(
`documentNum`
BIGINT
NOT
NULL
,
`id`
INT
NOT
NULL
AUTO_INCREMENT
,
`documentNum`
CHAR
(
255
)
NOT
NULL
,
`firstName`
CHAR
(
255
)
NULL
,
`firstName`
CHAR
(
255
)
NULL
,
`lastName`
CHAR
(
255
)
NULL
,
`lastName`
CHAR
(
255
)
NULL
,
`dateOfBirth`
CHAR
(
255
)
NULL
,
`dateOfBirth`
CHAR
(
255
)
NULL
,
...
@@ -20,18 +25,15 @@ CREATE TABLE `Users`(
...
@@ -20,18 +25,15 @@ CREATE TABLE `Users`(
`checkedIn`
TINYINT
(
1
)
NOT
NULL
,
`checkedIn`
TINYINT
(
1
)
NOT
NULL
,
`seat`
CHAR
(
255
)
NOT
NULL
,
`seat`
CHAR
(
255
)
NOT
NULL
,
`luggageClass`
INT
NOT
NULL
,
`luggageClass`
INT
NOT
NULL
,
primary
key
(
documentNum
)
primary
key
(
id
)
);
);
ALTER
TABLE
`Bookings`
ADD
CONSTRAINT
`bookings_flightnum_foreign`
FOREIGN
KEY
(
`flightNum`
)
REFERENCES
`Flights`
(
`destination`
);
ALTER
TABLE
`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
),
(
"Kuressaare"
,
"021440JUN23"
,
72
),
(
"Kuressaare"
,
"021440JUN23"
,
72
),
(
"K
ä
rdla"
,
"081700JUN23"
,
72
),
(
"K
a
rdla"
,
"081700JUN23"
,
72
),
(
"Stockholm"
,
"071230JUN23"
,
72
),
(
"Stockholm"
,
"071230JUN23"
,
72
),
(
"Riga"
,
"122200JUN23"
,
72
);
(
"Riga"
,
"122200JUN23"
,
72
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment