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 "qualifying" (
"qualifyId" INT,
"position" INT,
PRIMARY KEY ("qualifyId")
);



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 "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", "4", "1", "88000");
INSERT INTO "lapTimes" VALUES ("102", "5", "1", "87000");
INSERT INTO "drivers" VALUES ("1", "1985-07-15", "British");
INSERT INTO "drivers" VALUES ("2", "1979-03-22", "British");
INSERT INTO "drivers" VALUES ("3", "1982-11-05", "British");
INSERT INTO "drivers" VALUES ("4", "1990-01-30", "German");
INSERT INTO "drivers" VALUES ("5", "1983-06-12", "British");
INSERT INTO "drivers" VALUES ("6", "1975-09-10", "Italian");
INSERT INTO "drivers" VALUES ("7", "1981-12-01", "British");
INSERT INTO "drivers" VALUES ("8", "1980-05-20", "British");
INSERT INTO "drivers" VALUES ("9", "1995-04-18", "French");
INSERT INTO "qualifying" VALUES ("1", "1");
INSERT INTO "qualifying" VALUES ("2", "2");
INSERT INTO "qualifying" VALUES ("3", "3");
INSERT INTO "qualifying" VALUES ("4", "4");
INSERT INTO "qualifying" VALUES ("5", "5");
INSERT INTO "qualifying" VALUES ("6", "6");
INSERT INTO "qualifying" VALUES ("7", "7");
INSERT INTO "qualifying" VALUES ("8", "8");
INSERT INTO "qualifying" VALUES ("9", "9");