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 "drivers" (
"driverId" INT UNIQUE,
"forename" TEXT,
"surname" TEXT,
PRIMARY KEY ("driverId")
);

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

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



INSERT INTO "drivers" VALUES ("1", "Lewis", "Hamilton");
INSERT INTO "drivers" VALUES ("2", "Max", "Verstappen");
INSERT INTO "drivers" VALUES ("3", "Charles", "Leclerc");
INSERT INTO "drivers" VALUES ("4", "Sergio", "Perez");
INSERT INTO "drivers" VALUES ("5", "George", "Russell");
INSERT INTO "drivers" VALUES ("6", "Carlos", "Sainz");
INSERT INTO "drivers" VALUES ("7", "Lando", "Norris");
INSERT INTO "drivers" VALUES ("8", "Fernando", "Alonso");
INSERT INTO "drivers" VALUES ("9", "Valtteri", "Bottas");
INSERT INTO "drivers" VALUES ("10", "Daniel", "Ricciardo");
INSERT INTO "drivers" VALUES ("11", "Sebastian", "Vettel");
INSERT INTO "drivers" VALUES ("12", "Esteban", "Ocon");
INSERT INTO "drivers" VALUES ("13", "Pierre", "Gasly");
INSERT INTO "drivers" VALUES ("14", "Yuki", "Tsunoda");
INSERT INTO "drivers" VALUES ("15", "Alexander", "Albon");
INSERT INTO "drivers" VALUES ("16", "Lance", "Stroll");
INSERT INTO "drivers" VALUES ("17", "Kevin", "Magnussen");
INSERT INTO "drivers" VALUES ("18", "Mick", "Schumacher");
INSERT INTO "drivers" VALUES ("19", "Guanyu", "Zhou");
INSERT INTO "drivers" VALUES ("20", "Nicholas", "Latifi");
INSERT INTO "races" VALUES ("1", "Bahrain Grand Prix");
INSERT INTO "races" VALUES ("2", "Saudi Arabian Grand Prix");
INSERT INTO "races" VALUES ("3", "Australian Grand Prix");
INSERT INTO "races" VALUES ("4", "Emilia Romagna Grand Prix");
INSERT INTO "races" VALUES ("5", "Miami Grand Prix");
INSERT INTO "races" VALUES ("6", "Spanish Grand Prix");
INSERT INTO "races" VALUES ("7", "Monaco Grand Prix");
INSERT INTO "races" VALUES ("8", "Azerbaijan Grand Prix");
INSERT INTO "races" VALUES ("9", "Canadian Grand Prix");
INSERT INTO "races" VALUES ("10", "British Grand Prix");
INSERT INTO "races" VALUES ("11", "Austrian Grand Prix");
INSERT INTO "races" VALUES ("12", "French Grand Prix");
INSERT INTO "races" VALUES ("13", "Hungarian Grand Prix");
INSERT INTO "races" VALUES ("14", "Belgian Grand Prix");
INSERT INTO "races" VALUES ("15", "Dutch Grand Prix");
INSERT INTO "races" VALUES ("16", "Italian Grand Prix");
INSERT INTO "races" VALUES ("17", "Singapore Grand Prix");
INSERT INTO "races" VALUES ("18", "Japanese Grand Prix");
INSERT INTO "races" VALUES ("19", "United States Grand Prix");
INSERT INTO "races" VALUES ("20", "Mexico City Grand Prix");
INSERT INTO "races" VALUES ("21", "Brazilian Grand Prix");
INSERT INTO "races" VALUES ("22", "Abu Dhabi Grand Prix");
INSERT INTO "results" VALUES ("1", "1", "1", "3");
INSERT INTO "results" VALUES ("2", "1", "2", "1");
INSERT INTO "results" VALUES ("3", "1", "3", "2");
INSERT INTO "results" VALUES ("4", "1", "4", "4");
INSERT INTO "results" VALUES ("5", "1", "5", "5");
INSERT INTO "results" VALUES ("6", "1", "6", "6");
INSERT INTO "results" VALUES ("7", "1", "7", "7");
INSERT INTO "results" VALUES ("8", "1", "8", "9");
INSERT INTO "results" VALUES ("9", "1", "9", "8");
INSERT INTO "results" VALUES ("10", "1", "10", "14");
INSERT INTO "results" VALUES ("11", "1", "11", "10");
INSERT INTO "results" VALUES ("12", "1", "12", "11");
INSERT INTO "results" VALUES ("13", "1", "13", "12");
INSERT INTO "results" VALUES ("14", "1", "14", "13");
INSERT INTO "results" VALUES ("15", "1", "15", "16");
INSERT INTO "results" VALUES ("16", "1", "16", "17");
INSERT INTO "results" VALUES ("17", "1", "17", "15");
INSERT INTO "results" VALUES ("18", "1", "18", "18");
INSERT INTO "results" VALUES ("19", "1", "19", "19");
INSERT INTO "results" VALUES ("20", "1", "20", "20");
INSERT INTO "results" VALUES ("21", "18", "1", "1");
INSERT INTO "results" VALUES ("22", "18", "2", "2");
INSERT INTO "results" VALUES ("23", "18", "3", "3");
INSERT INTO "results" VALUES ("24", "18", "4", "4");
INSERT INTO "results" VALUES ("25", "18", "5", "5");
INSERT INTO "results" VALUES ("26", "18", "6", "6");
INSERT INTO "results" VALUES ("27", "18", "7", "7");
INSERT INTO "results" VALUES ("28", "18", "8", "8");
INSERT INTO "results" VALUES ("29", "18", "9", "9");
INSERT INTO "results" VALUES ("30", "18", "10", "10");
INSERT INTO "results" VALUES ("31", "18", "11", "11");
INSERT INTO "results" VALUES ("32", "18", "12", "12");
INSERT INTO "results" VALUES ("33", "18", "13", "13");
INSERT INTO "results" VALUES ("34", "18", "14", "14");
INSERT INTO "results" VALUES ("35", "18", "15", "15");
INSERT INTO "results" VALUES ("36", "18", "16", "16");
INSERT INTO "results" VALUES ("37", "18", "17", "17");
INSERT INTO "results" VALUES ("38", "18", "18", "18");
INSERT INTO "results" VALUES ("39", "18", "19", "19");
INSERT INTO "results" VALUES ("40", "18", "20", "20");
INSERT INTO "results" VALUES ("41", "2", "1", "1");
INSERT INTO "results" VALUES ("42", "2", "2", "2");
INSERT INTO "results" VALUES ("43", "2", "3", "3");
INSERT INTO "results" VALUES ("44", "2", "4", "4");
INSERT INTO "results" VALUES ("45", "2", "5", "5");
INSERT INTO "results" VALUES ("46", "2", "6", "6");
INSERT INTO "results" VALUES ("47", "2", "7", "7");
INSERT INTO "results" VALUES ("48", "2", "8", "8");
INSERT INTO "results" VALUES ("49", "2", "9", "9");
INSERT INTO "results" VALUES ("50", "2", "10", "10");