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 "races" (
"raceId" INT,
"year" INT,
"round" INT,
"circuitId" INT,
"name" TEXT,
PRIMARY KEY ("raceId"),
FOREIGN KEY ("year") REFERENCES "seasons"("year")
);

CREATE TABLE "seasons" (
"year" INT UNIQUE,
"url" TEXT,
PRIMARY KEY ("year")
);



INSERT INTO "seasons" VALUES ("2018", "https://www.formula1.com/en/results.html/2018.html");
INSERT INTO "seasons" VALUES ("2019", "https://www.formula1.com/en/results.html/2019.html");
INSERT INTO "seasons" VALUES ("2020", "https://www.formula1.com/en/results.html/2020.html");
INSERT INTO "seasons" VALUES ("2021", "https://www.formula1.com/en/results.html/2021.html");
INSERT INTO "seasons" VALUES ("2022", "https://www.formula1.com/en/results.html/2022.html");
INSERT INTO "races" VALUES ("899", "2019", "15", "5", "Singapore Grand Prix");
INSERT INTO "races" VALUES ("900", "2020", "10", "7", "Eifel Grand Prix");
INSERT INTO "races" VALUES ("901", "2021", "12", "9", "Monza Grand Prix");
INSERT INTO "races" VALUES ("902", "2021", "13", "10", "Singapore Grand Prix");
INSERT INTO "races" VALUES ("903", "2022", "1", "1", "Bahrain Grand Prix");
INSERT INTO "races" VALUES ("904", "2022", "2", "2", "Saudi Arabian Grand Prix");
INSERT INTO "races" VALUES ("905", "2022", "3", "3", "Australian Grand Prix");