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,
"circuitId" INT,
"name" TEXT,
"date" DATE,
PRIMARY KEY ("raceId"),
FOREIGN KEY ("circuitId") REFERENCES "circuits"("circuitId")
);



INSERT INTO "circuits" VALUES ("1", "Silverstone Circuit", "Silverstone", "UK");
INSERT INTO "circuits" VALUES ("2", "Monza", "Monza", "Italy");
INSERT INTO "circuits" VALUES ("3", "Circuit de Monaco", "Monte Carlo", "Monaco");
INSERT INTO "circuits" VALUES ("4", "Circuit de Spa-Francorchamps", "Spa", "Belgium");
INSERT INTO "circuits" VALUES ("5", "Suzuka Circuit", "Suzuka", "Japan");
INSERT INTO "circuits" VALUES ("6", "Circuit Gilles Villeneuve", "Montreal", "Canada");
INSERT INTO "circuits" VALUES ("7", "Hungaroring", "Budapest", "Hungary");
INSERT INTO "circuits" VALUES ("8", "Autódromo José Carlos Pace", "São Paulo", "Brazil");
INSERT INTO "circuits" VALUES ("9", "Yas Marina Circuit", "Abu Dhabi", "UAE");
INSERT INTO "circuits" VALUES ("10", "Circuit of the Americas", "Austin", "USA");
INSERT INTO "races" VALUES ("1", "2000", "1", "British Grand Prix", "2000-04-23");
INSERT INTO "races" VALUES ("2", "2001", "1", "British Grand Prix", "2001-07-15");
INSERT INTO "races" VALUES ("3", "2002", "2", "Italian Grand Prix", "2002-09-15");
INSERT INTO "races" VALUES ("4", "2003", "1", "British Grand Prix", "2003-07-20");
INSERT INTO "races" VALUES ("5", "2004", "3", "Monaco Grand Prix", "2004-05-30");
INSERT INTO "races" VALUES ("6", "2005", "1", "British Grand Prix", "2005-07-10");
INSERT INTO "races" VALUES ("7", "2006", "4", "Belgian Grand Prix", "2006-09-17");
INSERT INTO "races" VALUES ("8", "2007", "1", "British Grand Prix", "2007-07-08");
INSERT INTO "races" VALUES ("9", "2008", "5", "Japanese Grand Prix", "2008-10-12");
INSERT INTO "races" VALUES ("10", "2009", "1", "British Grand Prix", "2009-06-21");
INSERT INTO "races" VALUES ("11", "2010", "1", "British Grand Prix", "2010-07-11");
INSERT INTO "races" VALUES ("12", "2011", "6", "Canadian Grand Prix", "2011-06-12");
INSERT INTO "races" VALUES ("13", "2012", "1", "British Grand Prix", "2012-07-08");
INSERT INTO "races" VALUES ("14", "2013", "7", "Hungarian Grand Prix", "2013-07-28");
INSERT INTO "races" VALUES ("15", "2014", "1", "British Grand Prix", "2014-07-06");
INSERT INTO "races" VALUES ("16", "2015", "8", "Brazilian Grand Prix", "2015-11-15");
INSERT INTO "races" VALUES ("17", "2016", "1", "British Grand Prix", "2016-07-10");
INSERT INTO "races" VALUES ("18", "2017", "9", "Abu Dhabi Grand Prix", "2017-11-26");
INSERT INTO "races" VALUES ("19", "2018", "1", "British Grand Prix", "2018-07-08");
INSERT INTO "races" VALUES ("20", "2019", "10", "United States Grand Prix", "2019-11-03");
INSERT INTO "races" VALUES ("21", "2020", "1", "British Grand Prix", "2020-08-02");
INSERT INTO "races" VALUES ("22", "2020", "1", "70th Anniversary Grand Prix", "2020-08-09");