-
-
Save edinssa/34c7fa48924ddd7120707f0bfbd9c9ff to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create table team ( | |
id INTEGER, | |
name TEXT, | |
country TEXT, | |
PRIMARY KEY (id) | |
); | |
CREATE TABLE car( | |
id INTEGER, | |
teamId INTEGER, | |
carNumber INTEGER, | |
weight INTEGER, | |
maxSpeed INTEGER, | |
PRIMARY KEY (id), | |
FOREIGN KEY(teamId) REFERENCES team(id) | |
); | |
CREATE TABLE pilot ( | |
id INTEGER, | |
carId INTEGER, | |
name TEXT, | |
birthDate INTEGER, | |
country TEXT, | |
PRIMARY KEY (id), | |
FOREIGN KEY (carId) REFERENCES car(id), | |
); | |
create table race ( | |
id INTEGER, | |
pilotId INTEGER, | |
date DATE, | |
numberOfLaps INTEGER, | |
primary KEY(id), | |
FOREIGN KEY (pilotId) REFERENCES pilot(id) | |
); | |
create table participation ( | |
pilotId INTEGER, | |
raceId INTEGER, | |
startingPosition TEXT, | |
finalPosition TEXT, | |
FOREIGN KEY (pilotID) REFERENCES pilot(id), | |
FOREIGN KEY (raceId) REFERENCES race(id), | |
PRIMAR KEY(pilotId, raceId) | |
); | |
create table circuit ( | |
city TEXT, | |
country TEXT, | |
distance INTEGER | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment