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,
"location" TEXT,
"country" TEXT,
PRIMARY KEY ("circuitId")
);

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



INSERT INTO "circuits" VALUES ("1", "Silverstone Circuit", "Silverstone", "United Kingdom");
INSERT INTO "circuits" VALUES ("2", "Monza Circuit", "Monza", "Italy");
INSERT INTO "circuits" VALUES ("3", "Spa-Francorchamps", "Stavelot", "Belgium");
INSERT INTO "circuits" VALUES ("4", "Suzuka Circuit", "Suzuka", "Japan");
INSERT INTO "circuits" VALUES ("5", "Circuit de Monaco", "Monaco", "Monaco");
INSERT INTO "circuits" VALUES ("6", "Circuit of the Americas", "Austin", "United States");
INSERT INTO "circuits" VALUES ("7", "Interlagos", "São Paulo", "Brazil");
INSERT INTO "races" VALUES ("101", "2010", "10", "1");
INSERT INTO "races" VALUES ("102", "2011", "9", "1");
INSERT INTO "races" VALUES ("103", "2013", "8", "1");
INSERT INTO "races" VALUES ("104", "2014", "10", "1");
INSERT INTO "races" VALUES ("105", "2015", "9", "1");
INSERT INTO "races" VALUES ("106", "2016", "10", "1");
INSERT INTO "races" VALUES ("107", "2017", "10", "1");
INSERT INTO "races" VALUES ("108", "2018", "9", "1");
INSERT INTO "races" VALUES ("109", "2018", "20", "1");
INSERT INTO "races" VALUES ("110", "2019", "10", "1");
INSERT INTO "races" VALUES ("111", "2020", "7", "1");
INSERT INTO "races" VALUES ("112", "2021", "10", "1");
INSERT INTO "races" VALUES ("201", "2010", "11", "2");
INSERT INTO "races" VALUES ("202", "2011", "10", "2");
INSERT INTO "races" VALUES ("203", "2012", "12", "3");
INSERT INTO "races" VALUES ("204", "2013", "13", "4");
INSERT INTO "races" VALUES ("205", "2014", "11", "5");
INSERT INTO "races" VALUES ("206", "2015", "12", "6");
INSERT INTO "races" VALUES ("207", "2016", "11", "7");
INSERT INTO "races" VALUES ("208", "2017", "12", "3");
INSERT INTO "races" VALUES ("209", "2019", "11", "4");
INSERT INTO "races" VALUES ("210", "2020", "8", "5");
INSERT INTO "races" VALUES ("211", "2021", "11", "6");