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 "drivers" VALUES ("1", "1980-01-01", "British");
INSERT INTO "drivers" VALUES ("2", "1980-12-31", "British");
INSERT INTO "drivers" VALUES ("3", "1980-06-15", "British");
INSERT INTO "drivers" VALUES ("4", "1980-03-22", "British");
INSERT INTO "drivers" VALUES ("5", "1980-11-05", "British");
INSERT INTO "drivers" VALUES ("6", "1980-07-30", "British");
INSERT INTO "drivers" VALUES ("7", "1980-09-10", "British");
INSERT INTO "drivers" VALUES ("8", "1980-05-25", "British");
INSERT INTO "drivers" VALUES ("9", "1980-08-14", "British");
INSERT INTO "drivers" VALUES ("10", "1980-10-20", "British");
INSERT INTO "drivers" VALUES ("11", "1980-04-01", "German");
INSERT INTO "drivers" VALUES ("12", "1980-12-15", "Italian");
INSERT INTO "drivers" VALUES ("13", "1979-12-31", "British");
INSERT INTO "drivers" VALUES ("14", "1981-01-01", "British");
INSERT INTO "drivers" VALUES ("15", "NULL", "British");
INSERT INTO "drivers" VALUES ("16", "1980-02-29", "NULL");
INSERT INTO "drivers" VALUES ("17", "1980-07-07", "French");
INSERT INTO "drivers" VALUES ("18", "1980-09-09", "British");
INSERT INTO "drivers" VALUES ("19", "1980-12-01", "British");
INSERT INTO "drivers" VALUES ("20", "1980-01-15", "British");