Skip to content

Instantly share code, notes, and snippets.

@edinssa
Created June 22, 2024 13:06
Show Gist options
  • Save edinssa/34c7fa48924ddd7120707f0bfbd9c9ff to your computer and use it in GitHub Desktop.
Save edinssa/34c7fa48924ddd7120707f0bfbd9c9ff to your computer and use it in GitHub Desktop.
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