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,
"points" FLOAT,
"position" INT,
PRIMARY KEY ("driverStandingsId")
);

CREATE TABLE "lapTimes" (
"raceId" INT,
"driverId" INT,
"lap" INT,
"time" TEXT,
PRIMARY KEY ("raceId", "driverId", "lap")
);

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



INSERT INTO "driverStandings" VALUES ("1", "150.5", "1");
INSERT INTO "driverStandings" VALUES ("2", "120.0", "2");
INSERT INTO "driverStandings" VALUES ("3", "90.0", "3");
INSERT INTO "driverStandings" VALUES ("4", "60.0", "4");
INSERT INTO "driverStandings" VALUES ("5", "30.0", "5");
INSERT INTO "drivers" VALUES ("1", "HAM");
INSERT INTO "drivers" VALUES ("2", "VER");
INSERT INTO "drivers" VALUES ("3", "NULL");
INSERT INTO "drivers" VALUES ("4", "LEC");
INSERT INTO "drivers" VALUES ("5", "NULL");
INSERT INTO "drivers" VALUES ("6", "SAI");
INSERT INTO "drivers" VALUES ("7", "NULL");
INSERT INTO "lapTimes" VALUES ("101", "1", "1", "1:20.345");
INSERT INTO "lapTimes" VALUES ("101", "2", "1", "1:20.567");
INSERT INTO "lapTimes" VALUES ("101", "3", "1", "1:21.000");
INSERT INTO "lapTimes" VALUES ("101", "4", "1", "1:20.789");
INSERT INTO "lapTimes" VALUES ("101", "5", "1", "1:22.123");
INSERT INTO "lapTimes" VALUES ("101", "6", "1", "1:20.456");
INSERT INTO "lapTimes" VALUES ("101", "7", "1", "1:23.000");
INSERT INTO "lapTimes" VALUES ("102", "1", "2", "1:19.876");
INSERT INTO "lapTimes" VALUES ("102", "2", "2", "1:20.234");
INSERT INTO "lapTimes" VALUES ("102", "3", "2", "1:21.345");
INSERT INTO "lapTimes" VALUES ("102", "4", "2", "1:20.654");
INSERT INTO "lapTimes" VALUES ("102", "5", "2", "1:22.456");
INSERT INTO "lapTimes" VALUES ("102", "6", "2", "1:20.123");
INSERT INTO "lapTimes" VALUES ("102", "7", "2", "1:23.456");