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

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



INSERT INTO "drivers" VALUES ("1", "hamilton", "Lewis", "Hamilton", "British");
INSERT INTO "drivers" VALUES ("2", "alonso", "Fernando", "Alonso", "Spanish");
INSERT INTO "drivers" VALUES ("3", "vettel", "Sebastian", "Vettel", "German");
INSERT INTO "drivers" VALUES ("4", "Kubica", "Robert", "Kubica", "Polish");
INSERT INTO "drivers" VALUES ("5", "raikkonen", "Kimi", "Räikkönen", "Finnish");
INSERT INTO "drivers" VALUES ("6", "verstappen", "Max", "Verstappen", "Dutch");
INSERT INTO "drivers" VALUES ("7", "leclerc", "Charles", "Leclerc", "Monegasque");
INSERT INTO "drivers" VALUES ("8", "ricciardo", "Daniel", "Ricciardo", "Australian");
INSERT INTO "lapTimes" VALUES ("1", "1", "1");
INSERT INTO "lapTimes" VALUES ("1", "1", "2");
INSERT INTO "lapTimes" VALUES ("1", "2", "1");
INSERT INTO "lapTimes" VALUES ("1", "3", "1");
INSERT INTO "lapTimes" VALUES ("2", "4", "1");
INSERT INTO "lapTimes" VALUES ("2", "4", "2");
INSERT INTO "lapTimes" VALUES ("2", "5", "1");
INSERT INTO "lapTimes" VALUES ("3", "1", "1");
INSERT INTO "lapTimes" VALUES ("3", "4", "1");
INSERT INTO "lapTimes" VALUES ("3", "6", "1");