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,
"driverId" INT,
PRIMARY KEY ("driverStandingsId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
);

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

CREATE TABLE "qualifying" (
"qualifyId" INT,
"driverId" INT,
PRIMARY KEY ("qualifyId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
);

CREATE TABLE "results" (
"resultId" INT,
"driverId" INT,
PRIMARY KEY ("resultId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
);



INSERT INTO "drivers" VALUES ("1", "HAM");
INSERT INTO "drivers" VALUES ("2", "ROS");
INSERT INTO "drivers" VALUES ("3", "NULL");
INSERT INTO "drivers" VALUES ("4", "VET");
INSERT INTO "drivers" VALUES ("5", "NULL");
INSERT INTO "drivers" VALUES ("6", "RIC");
INSERT INTO "drivers" VALUES ("7", "NULL");
INSERT INTO "drivers" VALUES ("8", "VER");
INSERT INTO "drivers" VALUES ("9", "BOT");
INSERT INTO "drivers" VALUES ("10", "NULL");
INSERT INTO "driverStandings" VALUES ("101", "1");
INSERT INTO "driverStandings" VALUES ("102", "2");
INSERT INTO "driverStandings" VALUES ("103", "3");
INSERT INTO "driverStandings" VALUES ("104", "4");
INSERT INTO "driverStandings" VALUES ("105", "5");
INSERT INTO "driverStandings" VALUES ("106", "6");
INSERT INTO "driverStandings" VALUES ("107", "7");
INSERT INTO "driverStandings" VALUES ("108", "8");
INSERT INTO "driverStandings" VALUES ("109", "9");
INSERT INTO "driverStandings" VALUES ("110", "10");
INSERT INTO "qualifying" VALUES ("201", "1");
INSERT INTO "qualifying" VALUES ("202", "2");
INSERT INTO "qualifying" VALUES ("203", "3");
INSERT INTO "qualifying" VALUES ("204", "4");
INSERT INTO "qualifying" VALUES ("205", "5");
INSERT INTO "qualifying" VALUES ("206", "6");
INSERT INTO "qualifying" VALUES ("207", "7");
INSERT INTO "qualifying" VALUES ("208", "8");
INSERT INTO "qualifying" VALUES ("209", "9");
INSERT INTO "qualifying" VALUES ("210", "10");
INSERT INTO "results" VALUES ("301", "1");
INSERT INTO "results" VALUES ("302", "2");
INSERT INTO "results" VALUES ("303", "3");
INSERT INTO "results" VALUES ("304", "4");
INSERT INTO "results" VALUES ("305", "5");
INSERT INTO "results" VALUES ("306", "6");
INSERT INTO "results" VALUES ("307", "7");
INSERT INTO "results" VALUES ("308", "8");
INSERT INTO "results" VALUES ("309", "9");
INSERT INTO "results" VALUES ("310", "10");