Created
June 23, 2024 00:39
-
-
Save juryp/feac42960acd7e587e4cfedafefe91c3 to your computer and use it in GitHub Desktop.
formula1
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
-- Team Table | |
CREATE TABLE Team ( | |
TeamID INT PRIMARY KEY, | |
TeamName VARCHAR(100) NOT NULL, | |
Country VARCHAR(100), | |
Base VARCHAR(100), | |
Principal VARCHAR(100) | |
); | |
-- Car Table | |
CREATE TABLE Car ( | |
CarID INT PRIMARY KEY, | |
TeamID INT, | |
CarNumber INT, | |
Weight FLOAT, | |
MaxSpeed FLOAT, | |
FOREIGN KEY (TeamID) REFERENCES Team(TeamID) | |
); | |
-- Driver Table | |
CREATE TABLE Driver ( | |
DriverID INT PRIMARY KEY, | |
Name VARCHAR(100) NOT NULL, | |
Nationality VARCHAR(50), | |
DateOfBirth DATE, | |
CarID INT, | |
FOREIGN KEY (CarID) REFERENCES Car(CarID) | |
); | |
-- Circuit Table | |
CREATE TABLE Circuit ( | |
CircuitID INT PRIMARY KEY, | |
City VARCHAR(100), | |
Country VARCHAR(100), | |
Distance FLOAT | |
); | |
-- Race Table | |
CREATE TABLE Race ( | |
RaceID INT PRIMARY KEY AUTO_INCREMENT, | |
RaceName VARCHAR(100) NOT NULL, | |
Location VARCHAR(100), | |
Date DATE, | |
NumberOfLaps INT, | |
CircuitID INT, | |
FOREIGN KEY (CircuitID) REFERENCES Circuit(CircuitID) | |
); | |
-- Participation Table | |
CREATE TABLE Participation ( | |
ParticipationID INT PRIMARY KEY AUTO_INCREMENT, | |
DriverID INT, | |
RaceID INT, | |
StartingPosition INT, | |
FinalPosition INT, | |
Points DECIMAL(5, 2), | |
FOREIGN KEY (DriverID) REFERENCES Driver(DriverID), | |
FOREIGN KEY (RaceID) REFERENCES Race(RaceID) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment