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
d3906abf
authored
Mar 07, 2023
by
karade
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update Andmebaasi deklaratsioon.sql
parent
1db0bfd9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
11 deletions
Andmebaasi deklaratsioon.sql
Andmebaasi deklaratsioon.sql
View file @
d3906abf
...
...
@@ -4,19 +4,12 @@ CREATE TABLE `Flights`(
`seats`
INT
NOT
NULL
,
primary
key
(
destination
)
);
CREATE
TABLE
`Bookings`
(
`id`
BIGINT
UNSIGNED
NOT
NULL
AUTO_INCREMENT
,
`seat`
INT
NOT
NULL
,
`flightNum`
CHAR
(
255
)
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
)
);
CREATE
TABLE
`Users`
(
`documentNum`
BIGINT
NOT
NULL
,
`firstName`
CHAR
(
255
)
NULL
,
...
...
@@ -24,6 +17,9 @@ CREATE TABLE `Users`(
`dateOfBirth`
CHAR
(
255
)
NULL
,
`email`
CHAR
(
255
)
NULL
,
`residency`
CHAR
(
255
)
NULL
,
`checkedIn`
TINYINT
(
1
)
NOT
NULL
,
`seat`
CHAR
(
255
)
NOT
NULL
,
`luggageClass`
INT
NOT
NULL
,
primary
key
(
documentNum
)
);
...
...
@@ -31,12 +27,11 @@ 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
)
VALUES
(
"Helsinki"
,
"050950JUN23"
,
72
),
(
"Kuressaare"
,
"021440JUN23"
,
72
),
(
"Kärdla"
,
"081700JUN23"
,
72
),
(
"Stockholm"
,
"071230JUN23"
,
72
),
(
"Riga"
,
"122200JUN23"
,
72
);
\ No newline at end of file
(
"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