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

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

CREATE TABLE "qualifying" (
"qualifyId" INT,
"raceId" INT,
"driverId" INT,
"position" INT,
"q2" TEXT,
PRIMARY KEY ("qualifyId"),
FOREIGN KEY ("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
);

CREATE TABLE "races" (
"raceId" INT UNIQUE,
PRIMARY KEY ("raceId")
);



INSERT INTO "races" VALUES ("355");
INSERT INTO "races" VALUES ("356");
INSERT INTO "drivers" VALUES ("101", "British");
INSERT INTO "drivers" VALUES ("102", "German");
INSERT INTO "drivers" VALUES ("103", "Italian");
INSERT INTO "drivers" VALUES ("104", "Spanish");
INSERT INTO "qualifying" VALUES ("1", "355", "101", "1", "0:01:38");
INSERT INTO "qualifying" VALUES ("2", "355", "102", "2", "0:01:40");
INSERT INTO "qualifying" VALUES ("3", "355", "103", "3", "0:01:42");
INSERT INTO "qualifying" VALUES ("4", "356", "104", "1", "0:01:39");
INSERT INTO "qualifying" VALUES ("5", "356", "101", "2", "0:01:41");
INSERT INTO "driverStandings" VALUES ("1", "1");
INSERT INTO "driverStandings" VALUES ("2", "2");
INSERT INTO "driverStandings" VALUES ("3", "3");
INSERT INTO "driverStandings" VALUES ("4", "4");