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 "constructorResults" (
"constructorResultsId" INT,
"constructorId" INT,
PRIMARY KEY ("constructorResultsId")
);

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

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

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



INSERT INTO "constructorResults" VALUES ("1", "1");
INSERT INTO "constructorResults" VALUES ("2", "2");
INSERT INTO "constructorResults" VALUES ("3", "3");
INSERT INTO "constructorResults" VALUES ("4", "4");
INSERT INTO "constructorResults" VALUES ("5", "5");
INSERT INTO "drivers" VALUES ("1", "Lewis", "Hamilton");
INSERT INTO "drivers" VALUES ("2", "Sebastian", "Vettel");
INSERT INTO "drivers" VALUES ("3", "Max", "Verstappen");
INSERT INTO "drivers" VALUES ("4", "Charles", "Leclerc");
INSERT INTO "drivers" VALUES ("5", "Fernando", "Alonso");
INSERT INTO "races" VALUES ("100", "2007");
INSERT INTO "races" VALUES ("101", "2008");
INSERT INTO "races" VALUES ("102", "2009");
INSERT INTO "races" VALUES ("103", "2010");
INSERT INTO "races" VALUES ("104", "2011");
INSERT INTO "races" VALUES ("105", "2012");
INSERT INTO "races" VALUES ("106", "2013");
INSERT INTO "races" VALUES ("107", "2014");
INSERT INTO "races" VALUES ("108", "2015");
INSERT INTO "races" VALUES ("109", "2016");
INSERT INTO "races" VALUES ("110", "2017");
INSERT INTO "races" VALUES ("111", "2018");
INSERT INTO "races" VALUES ("112", "2019");
INSERT INTO "races" VALUES ("113", "2020");
INSERT INTO "races" VALUES ("114", "2021");
INSERT INTO "races" VALUES ("115", "2022");
INSERT INTO "races" VALUES ("116", "2023");
INSERT INTO "results" VALUES ("1", "100", "1", "3", "6.0");
INSERT INTO "results" VALUES ("2", "100", "2", "1", "10.0");
INSERT INTO "results" VALUES ("3", "101", "1", "1", "10.0");
INSERT INTO "results" VALUES ("4", "101", "3", "5", "4.0");
INSERT INTO "results" VALUES ("5", "102", "1", "2", "8.0");
INSERT INTO "results" VALUES ("6", "102", "4", "4", "5.0");
INSERT INTO "results" VALUES ("7", "103", "2", "1", "10.0");
INSERT INTO "results" VALUES ("8", "103", "1", "5", "4.0");
INSERT INTO "results" VALUES ("9", "104", "1", "1", "25.0");
INSERT INTO "results" VALUES ("10", "104", "5", "2", "18.0");
INSERT INTO "results" VALUES ("11", "105", "1", "3", "15.0");
INSERT INTO "results" VALUES ("12", "106", "2", "1", "25.0");
INSERT INTO "results" VALUES ("13", "107", "1", "1", "25.0");
INSERT INTO "results" VALUES ("14", "108", "1", "1", "25.0");
INSERT INTO "results" VALUES ("15", "109", "1", "2", "18.0");
INSERT INTO "results" VALUES ("16", "110", "1", "1", "25.0");
INSERT INTO "results" VALUES ("17", "111", "1", "1", "25.0");
INSERT INTO "results" VALUES ("18", "112", "1", "1", "25.0");
INSERT INTO "results" VALUES ("19", "113", "1", "1", "25.0");
INSERT INTO "results" VALUES ("20", "114", "1", "2", "18.0");
INSERT INTO "results" VALUES ("21", "115", "1", "5", "10.0");
INSERT INTO "results" VALUES ("22", "116", "1", "3", "15.0");
INSERT INTO "results" VALUES ("23", "116", "2", "8", "4.0");
INSERT INTO "results" VALUES ("24", "115", "3", "1", "25.0");
INSERT INTO "results" VALUES ("25", "114", "3", "1", "25.0");
INSERT INTO "results" VALUES ("26", "113", "3", "2", "18.0");
INSERT INTO "results" VALUES ("27", "112", "3", "3", "15.0");
INSERT INTO "results" VALUES ("28", "111", "3", "2", "18.0");
INSERT INTO "results" VALUES ("29", "110", "3", "4", "12.0");
INSERT INTO "results" VALUES ("30", "109", "3", "1", "25.0");