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

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

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



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", "George", "Russell");
INSERT INTO "drivers" VALUES ("7", "Lando", "Norris");
INSERT INTO "drivers" VALUES ("8", "Daniel", "Ricciardo");
INSERT INTO "drivers" VALUES ("9", "Fernando", "Alonso");
INSERT INTO "drivers" VALUES ("10", "Esteban", "Ocon");
INSERT INTO "races" VALUES ("1", "Bahrain Grand Prix");
INSERT INTO "races" VALUES ("2", "Saudi Arabian Grand Prix");
INSERT INTO "races" VALUES ("3", "Australian Grand Prix");
INSERT INTO "races" VALUES ("4", "Emilia Romagna Grand Prix");
INSERT INTO "races" VALUES ("5", "Miami Grand Prix");
INSERT INTO "races" VALUES ("6", "Spanish Grand Prix");
INSERT INTO "races" VALUES ("7", "Monaco Grand Prix");
INSERT INTO "races" VALUES ("8", "Azerbaijan Grand Prix");
INSERT INTO "races" VALUES ("9", "Canadian Grand Prix");
INSERT INTO "races" VALUES ("10", "British Grand Prix");
INSERT INTO "races" VALUES ("11", "Austrian Grand Prix");
INSERT INTO "races" VALUES ("12", "French Grand Prix");
INSERT INTO "races" VALUES ("13", "Hungarian Grand Prix");
INSERT INTO "races" VALUES ("14", "Belgian Grand Prix");
INSERT INTO "races" VALUES ("15", "Dutch Grand Prix");
INSERT INTO "races" VALUES ("16", "Italian Grand Prix");
INSERT INTO "races" VALUES ("17", "Singapore Grand Prix");
INSERT INTO "races" VALUES ("18", "Japanese Grand Prix");
INSERT INTO "races" VALUES ("19", "United States Grand Prix");
INSERT INTO "races" VALUES ("20", "Mexico City Grand Prix");
INSERT INTO "races" VALUES ("21", "Brazilian Grand Prix");
INSERT INTO "races" VALUES ("22", "Abu Dhabi Grand Prix");
INSERT INTO "lapTimes" VALUES ("12", "1", "1", "00:01:35.123");
INSERT INTO "lapTimes" VALUES ("12", "1", "2", "00:01:34.876");
INSERT INTO "lapTimes" VALUES ("12", "1", "3", "00:01:35.500");
INSERT INTO "lapTimes" VALUES ("12", "1", "4", "00:01:35.200");
INSERT INTO "lapTimes" VALUES ("12", "2", "1", "00:01:34.900");
INSERT INTO "lapTimes" VALUES ("12", "2", "2", "00:01:34.700");
INSERT INTO "lapTimes" VALUES ("12", "2", "3", "00:01:35.800");
INSERT INTO "lapTimes" VALUES ("12", "2", "4", "00:01:35.100");
INSERT INTO "lapTimes" VALUES ("12", "3", "1", "00:01:35.500");
INSERT INTO "lapTimes" VALUES ("12", "3", "2", "00:01:35.200");
INSERT INTO "lapTimes" VALUES ("12", "3", "3", "00:01:36.100");
INSERT INTO "lapTimes" VALUES ("12", "3", "4", "00:01:35.900");
INSERT INTO "lapTimes" VALUES ("12", "4", "1", "00:01:35.000");
INSERT INTO "lapTimes" VALUES ("12", "4", "2", "00:01:34.950");
INSERT INTO "lapTimes" VALUES ("12", "4", "3", "00:01:36.500");
INSERT INTO "lapTimes" VALUES ("12", "4", "4", "00:01:35.700");
INSERT INTO "lapTimes" VALUES ("12", "5", "1", "00:01:35.300");
INSERT INTO "lapTimes" VALUES ("12", "5", "2", "00:01:35.100");
INSERT INTO "lapTimes" VALUES ("12", "5", "3", "00:01:36.000");
INSERT INTO "lapTimes" VALUES ("12", "5", "4", "00:01:35.800");
INSERT INTO "lapTimes" VALUES ("12", "6", "1", "00:01:35.250");
INSERT INTO "lapTimes" VALUES ("12", "6", "2", "00:01:35.050");
INSERT INTO "lapTimes" VALUES ("12", "6", "3", "00:01:36.700");
INSERT INTO "lapTimes" VALUES ("12", "6", "4", "00:01:36.100");
INSERT INTO "lapTimes" VALUES ("12", "7", "1", "00:01:35.400");
INSERT INTO "lapTimes" VALUES ("12", "7", "2", "00:01:35.200");
INSERT INTO "lapTimes" VALUES ("12", "7", "3", "00:01:36.200");
INSERT INTO "lapTimes" VALUES ("12", "7", "4", "00:01:35.950");
INSERT INTO "lapTimes" VALUES ("12", "8", "1", "00:01:35.600");
INSERT INTO "lapTimes" VALUES ("12", "8", "2", "00:01:35.300");
INSERT INTO "lapTimes" VALUES ("12", "8", "3", "00:01:36.900");
INSERT INTO "lapTimes" VALUES ("12", "8", "4", "00:01:36.300");
INSERT INTO "lapTimes" VALUES ("12", "9", "1", "00:01:35.700");
INSERT INTO "lapTimes" VALUES ("12", "9", "2", "00:01:35.400");
INSERT INTO "lapTimes" VALUES ("12", "9", "3", "00:01:37.000");
INSERT INTO "lapTimes" VALUES ("12", "9", "4", "00:01:36.400");
INSERT INTO "lapTimes" VALUES ("12", "10", "1", "00:01:35.800");
INSERT INTO "lapTimes" VALUES ("12", "10", "2", "00:01:35.500");
INSERT INTO "lapTimes" VALUES ("12", "10", "3", "00:01:36.800");
INSERT INTO "lapTimes" VALUES ("12", "10", "4", "00:01:36.250");
INSERT INTO "lapTimes" VALUES ("1", "1", "3", "00:01:30.000");
INSERT INTO "lapTimes" VALUES ("2", "2", "3", "00:01:31.000");
INSERT INTO "lapTimes" VALUES ("3", "3", "3", "00:01:32.000");