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

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

CREATE TABLE "drivers" (
"driverId" INT UNIQUE,
"dob" DATE,
"nationality" TEXT,
PRIMARY KEY ("driverId")
);

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



INSERT INTO "driverStandings" VALUES ("1", "150.5");
INSERT INTO "driverStandings" VALUES ("2", "120.0");
INSERT INTO "driverStandings" VALUES ("3", "95.0");
INSERT INTO "driverStandings" VALUES ("4", "80.0");
INSERT INTO "driverStandings" VALUES ("5", "60.0");
INSERT INTO "drivers" VALUES ("1", "1980-03-15", "British");
INSERT INTO "drivers" VALUES ("2", "1980-11-22", "British");
INSERT INTO "drivers" VALUES ("3", "1980-07-09", "British");
INSERT INTO "drivers" VALUES ("4", "1979-12-31", "British");
INSERT INTO "drivers" VALUES ("5", "1981-01-01", "British");
INSERT INTO "drivers" VALUES ("6", "1980-05-05", "German");
INSERT INTO "drivers" VALUES ("7", "1980-08-20", "British");
INSERT INTO "drivers" VALUES ("8", "1982-04-10", "British");
INSERT INTO "lapTimes" VALUES ("101", "1", "1", "90000");
INSERT INTO "lapTimes" VALUES ("101", "1", "2", "89500");
INSERT INTO "lapTimes" VALUES ("101", "2", "1", "91000");
INSERT INTO "lapTimes" VALUES ("101", "3", "1", "92000");
INSERT INTO "lapTimes" VALUES ("102", "7", "1", "88000");
INSERT INTO "lapTimes" VALUES ("102", "7", "2", "87000");
INSERT INTO "lapTimes" VALUES ("102", "4", "1", "93000");
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");