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,
"name" TEXT,
"url" 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://en.wikipedia.org/wiki/2018_Formula_One_World_Championship");
INSERT INTO "seasons" VALUES ("2019", "https://en.wikipedia.org/wiki/2019_Formula_One_World_Championship");
INSERT INTO "seasons" VALUES ("2020", "https://en.wikipedia.org/wiki/2020_Formula_One_World_Championship");
INSERT INTO "seasons" VALUES ("2021", "https://en.wikipedia.org/wiki/2021_Formula_One_World_Championship");
INSERT INTO "seasons" VALUES ("2022", "https://en.wikipedia.org/wiki/2022_Formula_One_World_Championship");
INSERT INTO "races" VALUES ("899", "2018", "18", "Brazilian Grand Prix", "https://en.wikipedia.org/wiki/2018_Brazilian_Grand_Prix");
INSERT INTO "races" VALUES ("900", "2019", "19", "Brazilian Grand Prix", "https://en.wikipedia.org/wiki/2019_Brazilian_Grand_Prix");
INSERT INTO "races" VALUES ("901", "2020", "17", "Turkish Grand Prix", "https://en.wikipedia.org/wiki/2020_Turkish_Grand_Prix");
INSERT INTO "races" VALUES ("902", "2021", "18", "Brazilian Grand Prix", "https://en.wikipedia.org/wiki/2021_Brazilian_Grand_Prix");
INSERT INTO "races" VALUES ("903", "2022", "19", "Brazilian Grand Prix", "https://en.wikipedia.org/wiki/2022_Brazilian_Grand_Prix");
INSERT INTO "races" VALUES ("904", "2020", "18", "Abu Dhabi Grand Prix", "https://en.wikipedia.org/wiki/2020_Abu_Dhabi_Grand_Prix");