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,
"driverRef" TEXT,
"forename" TEXT,
"surname" 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", "Hamilton", "Lewis", "Hamilton");
INSERT INTO "drivers" VALUES ("2", "vettel", "Sebastian", "Vettel");
INSERT INTO "drivers" VALUES ("3", "alonso", "Fernando", "Alonso");
INSERT INTO "drivers" VALUES ("4", "ricciardo", "Daniel", "Ricciardo");
INSERT INTO "drivers" VALUES ("5", "verstappen", "Max", "Verstappen");
INSERT INTO "drivers" VALUES ("6", "bottas", "Valtteri", "Bottas");
INSERT INTO "drivers" VALUES ("7", "leclerc", "Charles", "Leclerc");
INSERT INTO "drivers" VALUES ("8", "norris", "Lando", "Norris");
INSERT INTO "drivers" VALUES ("9", "sainz", "Carlos", "Sainz");
INSERT INTO "drivers" VALUES ("10", "perez", "Sergio", "Perez");
INSERT INTO "driverStandings" VALUES ("1", "1");
INSERT INTO "driverStandings" VALUES ("2", "2");
INSERT INTO "driverStandings" VALUES ("3", "3");
INSERT INTO "driverStandings" VALUES ("4", "4");
INSERT INTO "driverStandings" VALUES ("5", "5");
INSERT INTO "driverStandings" VALUES ("6", "6");
INSERT INTO "driverStandings" VALUES ("7", "7");
INSERT INTO "driverStandings" VALUES ("8", "8");
INSERT INTO "driverStandings" VALUES ("9", "9");
INSERT INTO "driverStandings" VALUES ("10", "10");
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");
INSERT INTO "qualifying" VALUES ("10", "10");
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");
INSERT INTO "results" VALUES ("6", "6");
INSERT INTO "results" VALUES ("7", "7");
INSERT INTO "results" VALUES ("8", "8");
INSERT INTO "results" VALUES ("9", "9");
INSERT INTO "results" VALUES ("10", "10");