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 "lapTimes" (
"raceId" INT,
"driverId" INT,
"lap" INT,
"time" TEXT,
"milliseconds" INT,
PRIMARY KEY ("raceId", "driverId", "lap"),
FOREIGN KEY ("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
);

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 "races" (
"raceId" INT UNIQUE,
"name" TEXT,
PRIMARY KEY ("raceId")
);

CREATE TABLE "results" (
"resultId" INT,
"position" INT,
PRIMARY KEY ("resultId")
);



INSERT INTO "constructors" VALUES ("1", "Mercedes");
INSERT INTO "constructors" VALUES ("2", "Red Bull Racing");
INSERT INTO "constructors" VALUES ("3", "Ferrari");
INSERT INTO "constructors" VALUES ("4", "McLaren");
INSERT INTO "constructors" VALUES ("5", "Aston Martin");
INSERT INTO "constructors" VALUES ("6", "Alpine");
INSERT INTO "constructors" VALUES ("7", "AlphaTauri");
INSERT INTO "constructors" VALUES ("8", "Alfa Romeo");
INSERT INTO "constructors" VALUES ("9", "Haas F1 Team");
INSERT INTO "constructors" VALUES ("10", "Williams");
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", "Sergio", "Perez");
INSERT INTO "drivers" VALUES ("5", "Carlos", "Sainz");
INSERT INTO "drivers" VALUES ("6", "Lando", "Norris");
INSERT INTO "drivers" VALUES ("7", "George", "Russell");
INSERT INTO "drivers" VALUES ("8", "Fernando", "Alonso");
INSERT INTO "drivers" VALUES ("9", "Esteban", "Ocon");
INSERT INTO "drivers" VALUES ("10", "Pierre", "Gasly");
INSERT INTO "drivers" VALUES ("11", "Daniel", "Ricciardo");
INSERT INTO "drivers" VALUES ("12", "Valtteri", "Bottas");
INSERT INTO "drivers" VALUES ("13", "Sebastian", "Vettel");
INSERT INTO "drivers" VALUES ("14", "Kimi", "Raikkonen");
INSERT INTO "drivers" VALUES ("15", "Nico", "Rosberg");
INSERT INTO "drivers" VALUES ("16", "Jenson", "Button");
INSERT INTO "drivers" VALUES ("17", "Michael", "Schumacher");
INSERT INTO "drivers" VALUES ("18", "Ayrton", "Senna");
INSERT INTO "drivers" VALUES ("19", "Alain", "Prost");
INSERT INTO "drivers" VALUES ("20", "Juan Manuel", "Fangio");
INSERT INTO "drivers" VALUES ("21", "Lance", "Stroll");
INSERT INTO "drivers" VALUES ("22", "Yuki", "Tsunoda");
INSERT INTO "drivers" VALUES ("23", "Zhou", "Guanyu");
INSERT INTO "drivers" VALUES ("24", "Kevin", "Magnussen");
INSERT INTO "drivers" VALUES ("25", "Alexander", "Albon");
INSERT INTO "races" VALUES ("1", "Monaco Grand Prix");
INSERT INTO "races" VALUES ("2", "British Grand Prix");
INSERT INTO "races" VALUES ("3", "Italian Grand Prix");
INSERT INTO "races" VALUES ("4", "Belgian Grand Prix");
INSERT INTO "races" VALUES ("5", "Japanese Grand Prix");
INSERT INTO "races" VALUES ("6", "Hungarian Grand Prix");
INSERT INTO "lapTimes" VALUES ("1", "1", "10", "1:12.500", "72500");
INSERT INTO "lapTimes" VALUES ("1", "2", "15", "1:13.100", "73100");
INSERT INTO "lapTimes" VALUES ("1", "3", "12", "1:12.800", "72800");
INSERT INTO "lapTimes" VALUES ("2", "1", "5", "1:26.000", "86000");
INSERT INTO "lapTimes" VALUES ("2", "2", "8", "1:25.500", "85500");
INSERT INTO "lapTimes" VALUES ("2", "4", "10", "1:25.750", "85750");
INSERT INTO "lapTimes" VALUES ("3", "3", "7", "1:20.123", "80123");
INSERT INTO "lapTimes" VALUES ("3", "5", "9", "1:20.050", "80050");
INSERT INTO "lapTimes" VALUES ("3", "6", "11", "1:20.300", "80300");
INSERT INTO "lapTimes" VALUES ("4", "7", "14", "1:44.999", "104999");
INSERT INTO "lapTimes" VALUES ("4", "8", "16", "1:45.100", "105100");
INSERT INTO "lapTimes" VALUES ("4", "9", "13", "1:44.800", "104800");
INSERT INTO "lapTimes" VALUES ("5", "10", "20", "1:30.000", "90000");
INSERT INTO "lapTimes" VALUES ("5", "11", "22", "1:29.800", "89800");
INSERT INTO "lapTimes" VALUES ("5", "12", "18", "1:30.150", "90150");
INSERT INTO "lapTimes" VALUES ("6", "13", "25", "1:18.700", "78700");
INSERT INTO "lapTimes" VALUES ("6", "14", "28", "1:18.500", "78500");
INSERT INTO "lapTimes" VALUES ("6", "15", "23", "1:18.900", "78900");
INSERT INTO "lapTimes" VALUES ("1", "16", "1", "1:12.000", "72000");
INSERT INTO "lapTimes" VALUES ("2", "17", "1", "1:24.900", "84900");
INSERT INTO "lapTimes" VALUES ("3", "18", "1", "1:19.500", "79500");
INSERT INTO "lapTimes" VALUES ("4", "19", "1", "1:44.000", "104000");
INSERT INTO "lapTimes" VALUES ("5", "20", "1", "1:29.000", "89000");
INSERT INTO "lapTimes" VALUES ("1", "21", "1", "1:11.900", "71900");
INSERT INTO "lapTimes" VALUES ("1", "22", "1", "1:12.100", "72100");
INSERT INTO "lapTimes" VALUES ("1", "23", "1", "1:12.200", "72200");
INSERT INTO "lapTimes" VALUES ("1", "24", "1", "1:12.300", "72300");
INSERT INTO "lapTimes" VALUES ("1", "25", "1", "1:12.400", "72400");
INSERT INTO "results" VALUES ("1", "1");
INSERT INTO "results" VALUES ("2", "2");
INSERT INTO "results" VALUES ("3", "3");
INSERT INTO "results" VALUES ("4", "4");
INSERT INTO "results" VALUES ("5", "5");
INSERT INTO "results" VALUES ("6", "6");
INSERT INTO "results" VALUES ("7", "7");
INSERT INTO "results" VALUES ("8", "8");
INSERT INTO "results" VALUES ("9", "9");
INSERT INTO "results" VALUES ("10", "10");
INSERT INTO "results" VALUES ("11", "11");
INSERT INTO "results" VALUES ("12", "12");
INSERT INTO "results" VALUES ("13", "13");
INSERT INTO "results" VALUES ("14", "14");
INSERT INTO "results" VALUES ("15", "15");
INSERT INTO "results" VALUES ("16", "16");
INSERT INTO "results" VALUES ("17", "17");
INSERT INTO "results" VALUES ("18", "18");
INSERT INTO "results" VALUES ("19", "19");
INSERT INTO "results" VALUES ("20", "20");
INSERT INTO "results" VALUES ("21", "21");
INSERT INTO "results" VALUES ("22", "22");
INSERT INTO "results" VALUES ("23", "23");
INSERT INTO "results" VALUES ("24", "24");
INSERT INTO "results" VALUES ("25", "25");