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

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



INSERT INTO "circuits" VALUES ("1", "Melbourne", "Australia");
INSERT INTO "circuits" VALUES ("2", "Sepang", "Malaysia");
INSERT INTO "circuits" VALUES ("3", "Sakhir", "Bahrain");
INSERT INTO "circuits" VALUES ("4", "Shanghai", "China");
INSERT INTO "circuits" VALUES ("5", "Barcelona", "Spain");
INSERT INTO "circuits" VALUES ("6", "Monte Carlo", "Monaco");
INSERT INTO "circuits" VALUES ("7", "Montreal", "Canada");
INSERT INTO "circuits" VALUES ("8", "Spielberg", "Austria");
INSERT INTO "circuits" VALUES ("9", "Silverstone", "UK");
INSERT INTO "circuits" VALUES ("10", "Hockenheim", "Germany");
INSERT INTO "circuits" VALUES ("11", "Budapest", "Hungary");
INSERT INTO "circuits" VALUES ("12", "Spa", "Belgium");
INSERT INTO "circuits" VALUES ("13", "Monza", "Italy");
INSERT INTO "circuits" VALUES ("14", "Singapore", "Singapore");
INSERT INTO "circuits" VALUES ("15", "Suzuka", "Japan");
INSERT INTO "circuits" VALUES ("16", "Sochi", "Russia");
INSERT INTO "circuits" VALUES ("17", "Austin", "USA");
INSERT INTO "circuits" VALUES ("18", "Mexico City", "Mexico");
INSERT INTO "circuits" VALUES ("19", "Sao Paulo", "Brazil");
INSERT INTO "circuits" VALUES ("20", "Abu Dhabi", "UAE");
INSERT INTO "circuits" VALUES ("21", "Imola", "Italy");
INSERT INTO "circuits" VALUES ("22", "Mugello", "Italy");
INSERT INTO "races" VALUES ("1", "2023", "1", "Australian Grand Prix");
INSERT INTO "races" VALUES ("2", "2023", "3", "Bahrain Grand Prix");
INSERT INTO "races" VALUES ("3", "2023", "4", "Chinese Grand Prix");
INSERT INTO "races" VALUES ("4", "2023", "5", "Spanish Grand Prix");
INSERT INTO "races" VALUES ("5", "2023", "6", "Monaco Grand Prix");
INSERT INTO "races" VALUES ("6", "2023", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("7", "2022", "1", "Australian Grand Prix");
INSERT INTO "races" VALUES ("8", "2022", "3", "Bahrain Grand Prix");
INSERT INTO "races" VALUES ("9", "2022", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("10", "2022", "21", "Emilia Romagna Grand Prix");
INSERT INTO "races" VALUES ("11", "2021", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("12", "2021", "21", "Emilia Romagna Grand Prix");
INSERT INTO "races" VALUES ("13", "2021", "22", "Tuscan Grand Prix");
INSERT INTO "races" VALUES ("14", "2020", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("15", "2020", "21", "Emilia Romagna Grand Prix");
INSERT INTO "races" VALUES ("16", "2020", "22", "Tuscan Grand Prix");
INSERT INTO "races" VALUES ("17", "2019", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("18", "2018", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("19", "2017", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("20", "2016", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("21", "2015", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("22", "2014", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("23", "2013", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("24", "2012", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("25", "2011", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("26", "2010", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("27", "2009", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("28", "2008", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("29", "2007", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("30", "2006", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("31", "2005", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("32", "2004", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("33", "2003", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("34", "2002", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("35", "2001", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("36", "2000", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("37", "1999", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("38", "1998", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("39", "1997", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("40", "1996", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("41", "1995", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("42", "1994", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("43", "1993", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("44", "1992", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("45", "1991", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("46", "1990", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("47", "1989", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("48", "1988", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("49", "1987", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("50", "1986", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("51", "1985", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("52", "1984", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("53", "1983", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("54", "1982", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("55", "1981", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("56", "1980", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("57", "1979", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("58", "1978", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("59", "1977", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("60", "1976", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("61", "1975", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("62", "1974", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("63", "1973", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("64", "1972", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("65", "1971", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("66", "1970", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("67", "1969", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("68", "1968", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("69", "1967", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("70", "1966", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("71", "1965", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("72", "1964", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("73", "1963", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("74", "1962", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("75", "1961", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("76", "1960", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("77", "1959", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("78", "1958", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("79", "1957", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("80", "1956", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("81", "1955", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("82", "1954", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("83", "1953", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("84", "1952", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("85", "1951", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("86", "1950", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("87", "2023", "2", "Malaysian Grand Prix");
INSERT INTO "races" VALUES ("88", "2023", "7", "Canadian Grand Prix");
INSERT INTO "races" VALUES ("89", "2023", "8", "Austrian Grand Prix");
INSERT INTO "races" VALUES ("90", "2023", "9", "British Grand Prix");
INSERT INTO "races" VALUES ("91", "2023", "10", "German Grand Prix");
INSERT INTO "races" VALUES ("92", "2023", "11", "Hungarian Grand Prix");
INSERT INTO "races" VALUES ("93", "2023", "12", "Belgian Grand Prix");
INSERT INTO "races" VALUES ("94", "2023", "14", "Singapore Grand Prix");
INSERT INTO "races" VALUES ("95", "2023", "15", "Japanese Grand Prix");
INSERT INTO "races" VALUES ("96", "2023", "16", "Russian Grand Prix");
INSERT INTO "races" VALUES ("97", "2023", "17", "United States Grand Prix");
INSERT INTO "races" VALUES ("98", "2023", "18", "Mexican Grand Prix");
INSERT INTO "races" VALUES ("99", "2023", "19", "Brazilian Grand Prix");
INSERT INTO "races" VALUES ("100", "2023", "20", "Abu Dhabi Grand Prix");