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,
PRIMARY KEY ("raceId"),
FOREIGN KEY ("year") REFERENCES "seasons"("year")
);

CREATE TABLE "results" (
"resultId" INT,
"raceId" INT,
PRIMARY KEY ("resultId"),
FOREIGN KEY ("raceId") REFERENCES "races"("raceId")
);

CREATE TABLE "seasons" (
"year" INT UNIQUE,
PRIMARY KEY ("year")
);



INSERT INTO "seasons" VALUES ("2000");
INSERT INTO "seasons" VALUES ("2001");
INSERT INTO "seasons" VALUES ("2002");
INSERT INTO "seasons" VALUES ("2003");
INSERT INTO "seasons" VALUES ("2004");
INSERT INTO "seasons" VALUES ("2005");
INSERT INTO "seasons" VALUES ("2006");
INSERT INTO "seasons" VALUES ("2007");
INSERT INTO "seasons" VALUES ("2008");
INSERT INTO "seasons" VALUES ("2009");
INSERT INTO "seasons" VALUES ("2010");
INSERT INTO "seasons" VALUES ("2011");
INSERT INTO "seasons" VALUES ("2012");
INSERT INTO "seasons" VALUES ("2013");
INSERT INTO "seasons" VALUES ("2014");
INSERT INTO "seasons" VALUES ("2015");
INSERT INTO "seasons" VALUES ("2016");
INSERT INTO "seasons" VALUES ("2017");
INSERT INTO "seasons" VALUES ("2018");
INSERT INTO "seasons" VALUES ("2019");
INSERT INTO "races" VALUES ("1", "2000", "1", "Australian Grand Prix");
INSERT INTO "races" VALUES ("2", "2000", "2", "Malaysian Grand Prix");
INSERT INTO "races" VALUES ("3", "2000", "3", "Brazilian Grand Prix");
INSERT INTO "races" VALUES ("4", "2001", "1", "Australian Grand Prix");
INSERT INTO "races" VALUES ("5", "2001", "2", "Malaysian Grand Prix");
INSERT INTO "races" VALUES ("6", "2001", "3", "Brazilian Grand Prix");
INSERT INTO "races" VALUES ("7", "2001", "4", "San Marino Grand Prix");
INSERT INTO "races" VALUES ("8", "2002", "1", "Australian Grand Prix");
INSERT INTO "races" VALUES ("9", "2002", "2", "Malaysian Grand Prix");
INSERT INTO "races" VALUES ("10", "2002", "3", "Brazilian Grand Prix");
INSERT INTO "races" VALUES ("11", "2002", "4", "San Marino Grand Prix");
INSERT INTO "races" VALUES ("12", "2002", "5", "Spanish Grand Prix");
INSERT INTO "races" VALUES ("13", "2003", "1", "Australian Grand Prix");
INSERT INTO "races" VALUES ("14", "2003", "2", "Malaysian Grand Prix");
INSERT INTO "races" VALUES ("15", "2003", "3", "Brazilian Grand Prix");
INSERT INTO "races" VALUES ("16", "2003", "4", "San Marino Grand Prix");
INSERT INTO "races" VALUES ("17", "2003", "5", "Spanish Grand Prix");
INSERT INTO "races" VALUES ("18", "2003", "6", "Austrian Grand Prix");
INSERT INTO "races" VALUES ("19", "2004", "1", "Australian Grand Prix");
INSERT INTO "races" VALUES ("20", "2004", "2", "Malaysian Grand Prix");
INSERT INTO "races" VALUES ("21", "2004", "3", "Bahrain Grand Prix");
INSERT INTO "races" VALUES ("22", "2004", "4", "San Marino Grand Prix");
INSERT INTO "races" VALUES ("23", "2004", "5", "Spanish Grand Prix");
INSERT INTO "races" VALUES ("24", "2004", "6", "Monaco Grand Prix");
INSERT INTO "races" VALUES ("25", "2004", "7", "European Grand Prix");
INSERT INTO "races" VALUES ("26", "2005", "1", "Australian Grand Prix");
INSERT INTO "races" VALUES ("27", "2005", "2", "Malaysian Grand Prix");
INSERT INTO "races" VALUES ("28", "2005", "3", "Bahrain Grand Prix");
INSERT INTO "races" VALUES ("29", "2005", "4", "San Marino Grand Prix");
INSERT INTO "races" VALUES ("30", "2005", "5", "Spanish Grand Prix");
INSERT INTO "races" VALUES ("31", "2005", "6", "Monaco Grand Prix");
INSERT INTO "races" VALUES ("32", "2005", "7", "European Grand Prix");
INSERT INTO "races" VALUES ("33", "2005", "8", "Canadian Grand Prix");
INSERT INTO "races" VALUES ("34", "2006", "1", "Bahrain Grand Prix");
INSERT INTO "races" VALUES ("35", "2006", "2", "Malaysian Grand Prix");
INSERT INTO "races" VALUES ("36", "2006", "3", "Australian Grand Prix");
INSERT INTO "races" VALUES ("37", "2006", "4", "San Marino Grand Prix");
INSERT INTO "races" VALUES ("38", "2006", "5", "European Grand Prix");
INSERT INTO "races" VALUES ("39", "2006", "6", "Spanish Grand Prix");
INSERT INTO "races" VALUES ("40", "2006", "7", "Monaco Grand Prix");
INSERT INTO "races" VALUES ("41", "2006", "8", "British Grand Prix");
INSERT INTO "races" VALUES ("42", "2006", "9", "Canadian Grand Prix");
INSERT INTO "races" VALUES ("43", "2006", "10", "United States Grand Prix");
INSERT INTO "races" VALUES ("44", "2007", "1", "Australian Grand Prix");
INSERT INTO "races" VALUES ("45", "2007", "2", "Malaysian Grand Prix");
INSERT INTO "races" VALUES ("46", "2007", "3", "Bahrain Grand Prix");
INSERT INTO "races" VALUES ("47", "2007", "4", "Spanish Grand Prix");
INSERT INTO "races" VALUES ("48", "2007", "5", "Monaco Grand Prix");
INSERT INTO "races" VALUES ("49", "2007", "6", "Canadian Grand Prix");
INSERT INTO "races" VALUES ("50", "2007", "7", "United States Grand Prix");
INSERT INTO "races" VALUES ("51", "2007", "8", "French Grand Prix");
INSERT INTO "races" VALUES ("52", "2007", "9", "British Grand Prix");
INSERT INTO "races" VALUES ("53", "2007", "10", "European Grand Prix");
INSERT INTO "races" VALUES ("54", "2007", "11", "Hungarian Grand Prix");
INSERT INTO "races" VALUES ("55", "2007", "12", "Turkish Grand Prix");
INSERT INTO "races" VALUES ("56", "2007", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("57", "2007", "14", "Belgian Grand Prix");
INSERT INTO "races" VALUES ("58", "2007", "15", "Japanese Grand Prix");
INSERT INTO "races" VALUES ("59", "2007", "16", "Chinese Grand Prix");
INSERT INTO "races" VALUES ("60", "2007", "17", "Brazilian Grand Prix");
INSERT INTO "races" VALUES ("61", "2008", "1", "Australian Grand Prix");
INSERT INTO "races" VALUES ("62", "2008", "2", "Malaysian Grand Prix");
INSERT INTO "races" VALUES ("63", "2008", "3", "Bahrain Grand Prix");
INSERT INTO "races" VALUES ("64", "2008", "4", "Spanish Grand Prix");
INSERT INTO "races" VALUES ("65", "2008", "5", "Turkish Grand Prix");
INSERT INTO "races" VALUES ("66", "2008", "6", "Monaco Grand Prix");
INSERT INTO "races" VALUES ("67", "2008", "7", "Canadian Grand Prix");
INSERT INTO "races" VALUES ("68", "2008", "8", "French Grand Prix");
INSERT INTO "races" VALUES ("69", "2008", "9", "British Grand Prix");
INSERT INTO "races" VALUES ("70", "2008", "10", "German Grand Prix");
INSERT INTO "races" VALUES ("71", "2008", "11", "Hungarian Grand Prix");
INSERT INTO "races" VALUES ("72", "2008", "12", "European Grand Prix");
INSERT INTO "races" VALUES ("73", "2008", "13", "Belgian Grand Prix");
INSERT INTO "races" VALUES ("74", "2008", "14", "Italian Grand Prix");
INSERT INTO "races" VALUES ("75", "2008", "15", "Singapore Grand Prix");
INSERT INTO "races" VALUES ("76", "2008", "16", "Japanese Grand Prix");
INSERT INTO "races" VALUES ("77", "2008", "17", "Chinese Grand Prix");
INSERT INTO "races" VALUES ("78", "2008", "18", "Brazilian Grand Prix");
INSERT INTO "races" VALUES ("79", "2009", "1", "Australian Grand Prix");
INSERT INTO "races" VALUES ("80", "2009", "2", "Malaysian Grand Prix");
INSERT INTO "races" VALUES ("81", "2009", "3", "Chinese Grand Prix");
INSERT INTO "races" VALUES ("82", "2009", "4", "Bahrain Grand Prix");
INSERT INTO "races" VALUES ("83", "2009", "5", "Spanish Grand Prix");
INSERT INTO "races" VALUES ("84", "2009", "6", "Monaco Grand Prix");
INSERT INTO "races" VALUES ("85", "2009", "7", "Turkish Grand Prix");
INSERT INTO "races" VALUES ("86", "2009", "8", "British Grand Prix");
INSERT INTO "races" VALUES ("87", "2009", "9", "German Grand Prix");
INSERT INTO "races" VALUES ("88", "2009", "10", "Hungarian Grand Prix");
INSERT INTO "races" VALUES ("89", "2009", "11", "European Grand Prix");
INSERT INTO "races" VALUES ("90", "2009", "12", "Belgian Grand Prix");
INSERT INTO "races" VALUES ("91", "2009", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("92", "2009", "14", "Singapore Grand Prix");
INSERT INTO "races" VALUES ("93", "2009", "15", "Japanese Grand Prix");
INSERT INTO "races" VALUES ("94", "2009", "16", "Brazilian Grand Prix");
INSERT INTO "races" VALUES ("95", "2009", "17", "Abu Dhabi Grand Prix");
INSERT INTO "races" VALUES ("96", "2010", "1", "Bahrain Grand Prix");
INSERT INTO "races" VALUES ("97", "2010", "2", "Australian Grand Prix");
INSERT INTO "races" VALUES ("98", "2010", "3", "Malaysian Grand Prix");
INSERT INTO "races" VALUES ("99", "2010", "4", "Chinese Grand Prix");
INSERT INTO "races" VALUES ("100", "2010", "5", "Spanish Grand Prix");
INSERT INTO "races" VALUES ("101", "2010", "6", "Monaco Grand Prix");
INSERT INTO "races" VALUES ("102", "2010", "7", "Turkish Grand Prix");
INSERT INTO "races" VALUES ("103", "2010", "8", "Canadian Grand Prix");
INSERT INTO "races" VALUES ("104", "2010", "9", "European Grand Prix");
INSERT INTO "races" VALUES ("105", "2010", "10", "British Grand Prix");
INSERT INTO "races" VALUES ("106", "2010", "11", "German Grand Prix");
INSERT INTO "races" VALUES ("107", "2010", "12", "Hungarian Grand Prix");
INSERT INTO "races" VALUES ("108", "2010", "13", "Belgian Grand Prix");
INSERT INTO "races" VALUES ("109", "2010", "14", "Italian Grand Prix");
INSERT INTO "races" VALUES ("110", "2010", "15", "Singapore Grand Prix");
INSERT INTO "races" VALUES ("111", "2010", "16", "Japanese Grand Prix");
INSERT INTO "races" VALUES ("112", "2010", "17", "Korean Grand Prix");
INSERT INTO "races" VALUES ("113", "2010", "18", "Brazilian Grand Prix");
INSERT INTO "races" VALUES ("114", "2010", "19", "Abu Dhabi Grand Prix");
INSERT INTO "races" VALUES ("115", "2011", "1", "Australian Grand Prix");
INSERT INTO "races" VALUES ("116", "2011", "2", "Malaysian Grand Prix");
INSERT INTO "races" VALUES ("117", "2011", "3", "Chinese Grand Prix");
INSERT INTO "races" VALUES ("118", "2011", "4", "Turkish Grand Prix");
INSERT INTO "races" VALUES ("119", "2011", "5", "Spanish Grand Prix");
INSERT INTO "races" VALUES ("120", "2011", "6", "Monaco Grand Prix");
INSERT INTO "races" VALUES ("121", "2011", "7", "Canadian Grand Prix");
INSERT INTO "races" VALUES ("122", "2011", "8", "European Grand Prix");
INSERT INTO "races" VALUES ("123", "2011", "9", "British Grand Prix");
INSERT INTO "races" VALUES ("124", "2011", "10", "German Grand Prix");
INSERT INTO "races" VALUES ("125", "2011", "11", "Hungarian Grand Prix");
INSERT INTO "races" VALUES ("126", "2011", "12", "Belgian Grand Prix");
INSERT INTO "races" VALUES ("127", "2011", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("128", "2011", "14", "Singapore Grand Prix");
INSERT INTO "races" VALUES ("129", "2011", "15", "Japanese Grand Prix");
INSERT INTO "races" VALUES ("130", "2011", "16", "Korean Grand Prix");
INSERT INTO "races" VALUES ("131", "2011", "17", "Indian Grand Prix");
INSERT INTO "races" VALUES ("132", "2011", "18", "Abu Dhabi Grand Prix");
INSERT INTO "races" VALUES ("133", "2011", "19", "Brazilian Grand Prix");
INSERT INTO "races" VALUES ("134", "2012", "1", "Australian Grand Prix");
INSERT INTO "races" VALUES ("135", "2012", "2", "Malaysian Grand Prix");
INSERT INTO "races" VALUES ("136", "2012", "3", "Chinese Grand Prix");
INSERT INTO "races" VALUES ("137", "2012", "4", "Bahrain Grand Prix");
INSERT INTO "races" VALUES ("138", "2012", "5", "Spanish Grand Prix");
INSERT INTO "races" VALUES ("139", "2012", "6", "Monaco Grand Prix");
INSERT INTO "races" VALUES ("140", "2012", "7", "Canadian Grand Prix");
INSERT INTO "races" VALUES ("141", "2012", "8", "European Grand Prix");
INSERT INTO "races" VALUES ("142", "2012", "9", "British Grand Prix");
INSERT INTO "races" VALUES ("143", "2012", "10", "German Grand Prix");
INSERT INTO "races" VALUES ("144", "2012", "11", "Hungarian Grand Prix");
INSERT INTO "races" VALUES ("145", "2012", "12", "Belgian Grand Prix");
INSERT INTO "races" VALUES ("146", "2012", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("147", "2012", "14", "Singapore Grand Prix");
INSERT INTO "races" VALUES ("148", "2012", "15", "Japanese Grand Prix");
INSERT INTO "races" VALUES ("149", "2012", "16", "Korean Grand Prix");
INSERT INTO "races" VALUES ("150", "2012", "17", "Indian Grand Prix");
INSERT INTO "races" VALUES ("151", "2012", "18", "Abu Dhabi Grand Prix");
INSERT INTO "races" VALUES ("152", "2012", "19", "United States Grand Prix");
INSERT INTO "races" VALUES ("153", "2012", "20", "Brazilian Grand Prix");
INSERT INTO "races" VALUES ("154", "2013", "1", "Australian Grand Prix");
INSERT INTO "races" VALUES ("155", "2013", "2", "Malaysian Grand Prix");
INSERT INTO "races" VALUES ("156", "2013", "3", "Chinese Grand Prix");
INSERT INTO "races" VALUES ("157", "2013", "4", "Bahrain Grand Prix");
INSERT INTO "races" VALUES ("158", "2013", "5", "Spanish Grand Prix");
INSERT INTO "races" VALUES ("159", "2013", "6", "Monaco Grand Prix");
INSERT INTO "races" VALUES ("160", "2013", "7", "Canadian Grand Prix");
INSERT INTO "races" VALUES ("161", "2013", "8", "British Grand Prix");
INSERT INTO "races" VALUES ("162", "2013", "9", "German Grand Prix");
INSERT INTO "races" VALUES ("163", "2013", "10", "Hungarian Grand Prix");
INSERT INTO "races" VALUES ("164", "2013", "11", "Belgian Grand Prix");
INSERT INTO "races" VALUES ("165", "2013", "12", "Italian Grand Prix");
INSERT INTO "races" VALUES ("166", "2013", "13", "Singapore Grand Prix");
INSERT INTO "races" VALUES ("167", "2013", "14", "Korean Grand Prix");
INSERT INTO "races" VALUES ("168", "2013", "15", "Japanese Grand Prix");
INSERT INTO "races" VALUES ("169", "2013", "16", "Indian Grand Prix");
INSERT INTO "races" VALUES ("170", "2013", "17", "Abu Dhabi Grand Prix");
INSERT INTO "races" VALUES ("171", "2013", "18", "United States Grand Prix");
INSERT INTO "races" VALUES ("172", "2013", "19", "Brazilian Grand Prix");
INSERT INTO "races" VALUES ("173", "2014", "1", "Australian Grand Prix");
INSERT INTO "races" VALUES ("174", "2014", "2", "Malaysian Grand Prix");
INSERT INTO "races" VALUES ("175", "2014", "3", "Bahrain Grand Prix");
INSERT INTO "races" VALUES ("176", "2014", "4", "Chinese Grand Prix");
INSERT INTO "races" VALUES ("177", "2014", "5", "Spanish Grand Prix");
INSERT INTO "races" VALUES ("178", "2014", "6", "Monaco Grand Prix");
INSERT INTO "races" VALUES ("179", "2014", "7", "Canadian Grand Prix");
INSERT INTO "races" VALUES ("180", "2014", "8", "Austrian Grand Prix");
INSERT INTO "races" VALUES ("181", "2014", "9", "British Grand Prix");
INSERT INTO "races" VALUES ("182", "2014", "10", "German Grand Prix");
INSERT INTO "races" VALUES ("183", "2014", "11", "Hungarian Grand Prix");
INSERT INTO "races" VALUES ("184", "2014", "12", "Belgian Grand Prix");
INSERT INTO "races" VALUES ("185", "2014", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("186", "2014", "14", "Singapore Grand Prix");
INSERT INTO "races" VALUES ("187", "2014", "15", "Japanese Grand Prix");
INSERT INTO "races" VALUES ("188", "2014", "16", "Russian Grand Prix");
INSERT INTO "races" VALUES ("189", "2014", "17", "United States Grand Prix");
INSERT INTO "races" VALUES ("190", "2014", "18", "Brazilian Grand Prix");
INSERT INTO "races" VALUES ("191", "2014", "19", "Abu Dhabi Grand Prix");
INSERT INTO "races" VALUES ("192", "2015", "1", "Australian Grand Prix");
INSERT INTO "races" VALUES ("193", "2015", "2", "Malaysian Grand Prix");
INSERT INTO "races" VALUES ("194", "2015", "3", "Chinese Grand Prix");
INSERT INTO "races" VALUES ("195", "2015", "4", "Bahrain Grand Prix");
INSERT INTO "races" VALUES ("196", "2015", "5", "Spanish Grand Prix");
INSERT INTO "races" VALUES ("197", "2015", "6", "Monaco Grand Prix");
INSERT INTO "races" VALUES ("198", "2015", "7", "Canadian Grand Prix");
INSERT INTO "races" VALUES ("199", "2015", "8", "Austrian Grand Prix");
INSERT INTO "races" VALUES ("200", "2015", "9", "British Grand Prix");
INSERT INTO "races" VALUES ("201", "2015", "10", "Hungarian Grand Prix");
INSERT INTO "races" VALUES ("202", "2015", "11", "Belgian Grand Prix");
INSERT INTO "races" VALUES ("203", "2015", "12", "Italian Grand Prix");
INSERT INTO "races" VALUES ("204", "2015", "13", "Singapore Grand Prix");
INSERT INTO "races" VALUES ("205", "2015", "14", "Japanese Grand Prix");
INSERT INTO "races" VALUES ("206", "2015", "15", "Russian Grand Prix");
INSERT INTO "races" VALUES ("207", "2015", "16", "United States Grand Prix");
INSERT INTO "races" VALUES ("208", "2015", "17", "Mexican Grand Prix");
INSERT INTO "races" VALUES ("209", "2015", "18", "Brazilian Grand Prix");