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 "circuits" (
"circuitId" INT UNIQUE,
"name" TEXT,
"country" TEXT,
PRIMARY KEY ("circuitId")
);

CREATE TABLE "races" (
"raceId" INT,
"year" INT,
"circuitId" INT,
"name" TEXT,
"url" TEXT,
PRIMARY KEY ("raceId"),
FOREIGN KEY ("circuitId") REFERENCES "circuits"("circuitId")
);



INSERT INTO "circuits" VALUES ("1", "Circuit de Monaco", "Monaco");
INSERT INTO "circuits" VALUES ("2", "Circuit de Spa-Francorchamps", "Belgium");
INSERT INTO "circuits" VALUES ("3", "Circuit de Silverstone", "United Kingdom");
INSERT INTO "circuits" VALUES ("4", "Circuit de Barcelona-Catalunya", "Spain");
INSERT INTO "circuits" VALUES ("5", "Circuit Gilles Villeneuve", "Canada");
INSERT INTO "races" VALUES ("101", "2018", "4", "Spanish Grand Prix 2018", "https://www.formula1.com/en/racing/2018/Spain.html");
INSERT INTO "races" VALUES ("102", "2019", "4", "Spanish Grand Prix 2019", "https://www.formula1.com/en/racing/2019/Spain.html");
INSERT INTO "races" VALUES ("103", "2020", "4", "Spanish Grand Prix 2020", "https://www.formula1.com/en/racing/2020/Spain.html");
INSERT INTO "races" VALUES ("104", "2021", "4", "Spanish Grand Prix 2021", "https://www.formula1.com/en/racing/2021/Spain.html");
INSERT INTO "races" VALUES ("105", "2022", "4", "Spanish Grand Prix 2022", "https://www.formula1.com/en/racing/2022/Spain.html");
INSERT INTO "races" VALUES ("201", "2019", "1", "Monaco Grand Prix 2019", "https://www.formula1.com/en/racing/2019/Monaco.html");
INSERT INTO "races" VALUES ("202", "2020", "2", "Belgian Grand Prix 2020", "https://www.formula1.com/en/racing/2020/Belgium.html");
INSERT INTO "races" VALUES ("203", "2021", "3", "British Grand Prix 2021", "https://www.formula1.com/en/racing/2021/Great_Britain.html");
INSERT INTO "races" VALUES ("204", "2022", "5", "Canadian Grand Prix 2022", "https://www.formula1.com/en/racing/2022/Canada.html");