PRAGMA foreign_keys = ON;

PRAGMA writable_schema = 1;
DELETE FROM sqlite_master WHERE type IN ("table", "index", "trigger");
PRAGMA writable_schema = 0;
VACUUM;

CREATE TABLE "driverStandings" (
"driverStandingsId" INT,
"position" INT,
PRIMARY KEY ("driverStandingsId")
);

CREATE TABLE "constructors" (
"constructorId" INT,
"name" TEXT,
PRIMARY KEY ("constructorId")
);

CREATE TABLE "drivers" (
"driverId" INT UNIQUE,
"forename" TEXT,
"surname" TEXT,
PRIMARY KEY ("driverId")
);

CREATE TABLE "qualifying" (
"qualifyId" INT,
"position" INT,
PRIMARY KEY ("qualifyId")
);

CREATE TABLE "races" (
"raceId" INT UNIQUE,
"name" TEXT,
PRIMARY KEY ("raceId")
);

CREATE TABLE "results" (
"resultId" INT,
"raceId" INT,
"driverId" INT,
"points" FLOAT,
PRIMARY KEY ("resultId"),
FOREIGN KEY ("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
);



INSERT INTO "driverStandings" VALUES ("1", "1");
INSERT INTO "driverStandings" VALUES ("2", "2");
INSERT INTO "driverStandings" VALUES ("3", "3");
INSERT INTO "driverStandings" VALUES ("4", "4");
INSERT INTO "driverStandings" VALUES ("5", "5");
INSERT INTO "constructors" VALUES ("1", "Mercedes");
INSERT INTO "constructors" VALUES ("2", "Red Bull");
INSERT INTO "constructors" VALUES ("3", "Ferrari");
INSERT INTO "constructors" VALUES ("4", "McLaren");
INSERT INTO "constructors" VALUES ("5", "Aston Martin");
INSERT INTO "drivers" VALUES ("1", "Lewis", "Hamilton");
INSERT INTO "drivers" VALUES ("2", "Max", "Verstappen");
INSERT INTO "drivers" VALUES ("3", "Charles", "Leclerc");
INSERT INTO "drivers" VALUES ("4", "Sebastian", "Vettel");
INSERT INTO "drivers" VALUES ("5", "Fernando", "Alonso");
INSERT INTO "drivers" VALUES ("6", "Valtteri", "Bottas");
INSERT INTO "qualifying" VALUES ("1", "1");
INSERT INTO "qualifying" VALUES ("2", "2");
INSERT INTO "qualifying" VALUES ("3", "3");
INSERT INTO "qualifying" VALUES ("4", "4");
INSERT INTO "qualifying" VALUES ("5", "5");
INSERT INTO "races" VALUES ("1", "Turkish Grand Prix");
INSERT INTO "races" VALUES ("2", "British Grand Prix");
INSERT INTO "races" VALUES ("3", "Turkish Grand Prix");
INSERT INTO "races" VALUES ("4", "Italian Grand Prix");
INSERT INTO "races" VALUES ("5", "Turkish Grand Prix");
INSERT INTO "races" VALUES ("6", "Monaco Grand Prix");
INSERT INTO "results" VALUES ("1", "1", "1", "25.0");
INSERT INTO "results" VALUES ("2", "1", "2", "18.0");
INSERT INTO "results" VALUES ("3", "3", "1", "15.0");
INSERT INTO "results" VALUES ("4", "3", "3", "12.0");
INSERT INTO "results" VALUES ("5", "5", "1", "10.0");
INSERT INTO "results" VALUES ("6", "5", "4", "8.0");
INSERT INTO "results" VALUES ("7", "2", "1", "0.0");
INSERT INTO "results" VALUES ("8", "2", "2", "25.0");
INSERT INTO "results" VALUES ("9", "4", "3", "25.0");
INSERT INTO "results" VALUES ("10", "6", "1", "1.0");