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,
"lat" FLOAT,
"lng" FLOAT,
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", "Albert Park Grand Prix Circuit", "Melbourne", "Australia", "-37.8497", "144.968");
INSERT INTO "circuits" VALUES ("2", "Sepang International Circuit", "Kuala Lumpur", "Malaysia", "2.76083", "101.738");
INSERT INTO "circuits" VALUES ("3", "Bahrain International Circuit", "Sakhir", "Bahrain", "26.0325", "50.5106");
INSERT INTO "circuits" VALUES ("4", "Circuit de Barcelona-Catalunya", "Montmeló", "Spain", "41.57", "2.26111");
INSERT INTO "circuits" VALUES ("5", "Istanbul Park", "Istanbul", "Turkey", "40.9517", "29.405");
INSERT INTO "circuits" VALUES ("6", "Circuit de Monaco", "Monte-Carlo", "Monaco", "43.7347", "7.42056");
INSERT INTO "circuits" VALUES ("7", "Circuit Gilles Villeneuve", "Montreal", "Canada", "45.5", "-73.5228");
INSERT INTO "circuits" VALUES ("8", "Silverstone Circuit", "Silverstone", "UK", "52.0786", "-1.01694");
INSERT INTO "circuits" VALUES ("9", "Hockenheimring", "Hockenheim", "Germany", "49.3278", "8.56583");
INSERT INTO "circuits" VALUES ("10", "Hungaroring", "Budapest", "Hungary", "47.5789", "19.2486");
INSERT INTO "circuits" VALUES ("11", "Spa-Francorchamps", "Spa", "Belgium", "50.4394", "5.97139");
INSERT INTO "circuits" VALUES ("12", "Autodromo Nazionale di Monza", "Monza", "Italy", "45.6156", "9.28111");
INSERT INTO "circuits" VALUES ("13", "Marina Bay Street Circuit", "Singapore", "Singapore", "1.29167", "103.864");
INSERT INTO "circuits" VALUES ("14", "Suzuka Circuit", "Suzuka", "Japan", "34.8431", "136.538");
INSERT INTO "circuits" VALUES ("15", "Autódromo José Carlos Pace", "São Paulo", "Brazil", "-23.7036", "-46.6997");
INSERT INTO "circuits" VALUES ("16", "Yas Marina Circuit", "Abu Dhabi", "UAE", "24.4672", "54.6031");
INSERT INTO "circuits" VALUES ("17", "Nürburgring", "Nürburg", "Germany", "50.3356", "6.9475");
INSERT INTO "circuits" VALUES ("18", "Brands Hatch", "Fawkham", "UK", "51.3569", "0.263056");
INSERT INTO "circuits" VALUES ("19", "Donington Park", "Castle Donington", "UK", "52.8322", "-1.37528");
INSERT INTO "circuits" VALUES ("20", "Jerez", "Jerez de la Frontera", "Spain", "36.7092", "-6.03417");
INSERT INTO "circuits" VALUES ("21", "Circuito do Estoril", "Estoril", "Portugal", "38.7503", "-9.39417");
INSERT INTO "circuits" VALUES ("22", "Adelaide Street Circuit", "Adelaide", "Australia", "-34.9272", "138.617");
INSERT INTO "circuits" VALUES ("23", "Kyalami", "Midrand", "South Africa", "-25.9925", "28.0736");
INSERT INTO "circuits" VALUES ("24", "Circuit Paul Ricard", "Le Castellet", "France", "43.2506", "5.79167");
INSERT INTO "circuits" VALUES ("25", "Zandvoort", "Zandvoort", "Netherlands", "52.3889", "4.54056");
INSERT INTO "circuits" VALUES ("26", "Watkins Glen", "Watkins Glen", "USA", "42.3369", "-76.9272");
INSERT INTO "circuits" VALUES ("27", "Mont-Tremblant", "Mont-Tremblant", "Canada", "46.1875", "-74.5994");
INSERT INTO "circuits" VALUES ("28", "Riverside International Raceway", "Riverside", "USA", "33.9253", "-117.273");
INSERT INTO "circuits" VALUES ("29", "Sebring International Raceway", "Sebring", "USA", "27.4547", "-81.3483");
INSERT INTO "circuits" VALUES ("30", "Ain-Diab Circuit", "Casablanca", "Morocco", "33.5786", "-7.6875");
INSERT INTO "circuits" VALUES ("31", "Pescara Circuit", "Pescara", "Italy", "42.475", "14.175");
INSERT INTO "circuits" VALUES ("32", "Reims-Gueux", "Reims", "France", "49.2542", "3.93083");
INSERT INTO "circuits" VALUES ("33", "AVUS", "Berlin", "Germany", "52.4622", "13.2514");
INSERT INTO "circuits" VALUES ("34", "Bremgarten", "Bern", "Switzerland", "46.9589", "7.40194");
INSERT INTO "circuits" VALUES ("35", "Circuit de la Sarthe", "Le Mans", "France", "47.9506", "0.228333");
INSERT INTO "circuits" VALUES ("36", "Indianapolis Motor Speedway", "Indianapolis", "USA", "39.795", "-86.2347");
INSERT INTO "circuits" VALUES ("37", "Monza", "Monza", "Italy", "45.6156", "9.28111");
INSERT INTO "circuits" VALUES ("38", "Silverstone", "Silverstone", "UK", "52.0786", "-1.01694");
INSERT INTO "circuits" VALUES ("39", "Nürburgring Nordschleife", "Nürburg", "Germany", "50.3356", "6.9475");
INSERT INTO "circuits" VALUES ("40", "Zolder", "Heusden-Zolder", "Belgium", "50.9867", "5.25694");
INSERT INTO "circuits" VALUES ("41", "Dijon-Prenois", "Dijon", "France", "47.3625", "5.01889");
INSERT INTO "circuits" VALUES ("42", "Österreichring", "Spielberg", "Austria", "47.2197", "14.7647");
INSERT INTO "circuits" VALUES ("43", "Jacarepaguá", "Rio de Janeiro", "Brazil", "-22.9756", "-43.395");
INSERT INTO "circuits" VALUES ("44", "Detroit Street Circuit", "Detroit", "USA", "42.3292", "-83.0406");
INSERT INTO "circuits" VALUES ("45", "Dallas Fair Park", "Dallas", "USA", "32.7803", "-96.7708");
INSERT INTO "circuits" VALUES ("46", "Phoenix Street Circuit", "Phoenix", "USA", "33.4483", "-112.074");
INSERT INTO "circuits" VALUES ("47", "Circuit de Nevers Magny-Cours", "Magny-Cours", "France", "46.8642", "3.16361");
INSERT INTO "circuits" VALUES ("48", "Autódromo Juan y Oscar Gálvez", "Buenos Aires", "Argentina", "-34.695", "-58.4592");
INSERT INTO "circuits" VALUES ("49", "Kyalami Grand Prix Circuit", "Midrand", "South Africa", "-25.9925", "28.0736");
INSERT INTO "circuits" VALUES ("50", "Fuji Speedway", "Oyama", "Japan", "35.3717", "138.927");
INSERT INTO "circuits" VALUES ("51", "Okayama International Circuit", "Mimasaka", "Japan", "34.9153", "134.221");
INSERT INTO "circuits" VALUES ("52", "Aida", "Mimasaka", "Japan", "34.9153", "134.221");
INSERT INTO "circuits" VALUES ("53", "Autódromo Hermanos Rodríguez", "Mexico City", "Mexico", "19.4042", "-99.0911");
INSERT INTO "circuits" VALUES ("54", "Valencia Street Circuit", "Valencia", "Spain", "39.4589", "-0.331667");
INSERT INTO "circuits" VALUES ("55", "Baku City Circuit", "Baku", "Azerbaijan", "40.3725", "49.8533");
INSERT INTO "circuits" VALUES ("56", "Red Bull Ring", "Spielberg", "Austria", "47.2197", "14.7647");
INSERT INTO "circuits" VALUES ("57", "Sochi Autodrom", "Sochi", "Russia", "43.4058", "39.9578");
INSERT INTO "circuits" VALUES ("58", "Circuit of the Americas", "Austin", "USA", "30.1328", "-97.6411");
INSERT INTO "circuits" VALUES ("59", "Losail International Circuit", "Lusail", "Qatar", "25.49", "51.4542");
INSERT INTO "circuits" VALUES ("60", "Jeddah Corniche Circuit", "Jeddah", "Saudi Arabia", "21.6319", "39.1044");
INSERT INTO "circuits" VALUES ("61", "Miami International Autodrome", "Miami", "USA", "25.9581", "-80.2389");
INSERT INTO "circuits" VALUES ("62", "Las Vegas Strip Circuit", "Las Vegas", "USA", "36.1147", "-115.172");
INSERT INTO "circuits" VALUES ("63", "Shanghai International Circuit", "Shanghai", "China", "31.3389", "121.22");
INSERT INTO "circuits" VALUES ("64", "Korea International Circuit", "Yeongam", "South Korea", "34.7333", "126.417");
INSERT INTO "circuits" VALUES ("65", "Buddh International Circuit", "Greater Noida", "India", "28.3442", "77.5367");
INSERT INTO "circuits" VALUES ("66", "Portimão", "Portimão", "Portugal", "37.2278", "-8.62611");
INSERT INTO "circuits" VALUES ("67", "Mugello Circuit", "Scarperia e San Piero", "Italy", "43.9975", "11.3719");
INSERT INTO "circuits" VALUES ("68", "Imola", "Imola", "Italy", "44.3439", "11.7167");
INSERT INTO "circuits" VALUES ("69", "Zandvoort Circuit", "Zandvoort", "Netherlands", "52.3889", "4.54056");
INSERT INTO "circuits" VALUES ("70", "Paul Ricard", "Le Castellet", "France", "43.2506", "5.79167");
INSERT INTO "circuits" VALUES ("71", "Autódromo Internacional do Algarve", "Portimão", "Portugal", "37.2278", "-8.62611");
INSERT INTO "circuits" VALUES ("72", "Jeddah", "Jeddah", "Saudi Arabia", "21.6319", "39.1044");
INSERT INTO "circuits" VALUES ("73", "Miami", "Miami", "USA", "25.9581", "-80.2389");
INSERT INTO "circuits" VALUES ("74", "Las Vegas", "Las Vegas", "USA", "36.1147", "-115.172");
INSERT INTO "circuits" VALUES ("75", "Shanghai", "Shanghai", "China", "31.3389", "121.22");
INSERT INTO "circuits" VALUES ("76", "Yeongam", "Yeongam", "South Korea", "34.7333", "126.417");
INSERT INTO "circuits" VALUES ("77", "Greater Noida", "Greater Noida", "India", "28.3442", "77.5367");
INSERT INTO "circuits" VALUES ("78", "Portimão", "Portimão", "Portugal", "37.2278", "-8.62611");
INSERT INTO "circuits" VALUES ("79", "Mugello", "Scarperia e San Piero", "Italy", "43.9975", "11.3719");
INSERT INTO "circuits" VALUES ("80", "Imola Circuit", "Imola", "Italy", "44.3439", "11.7167");
INSERT INTO "races" VALUES ("1", "1983", "8", "European Grand Prix", "1983-09-25");
INSERT INTO "races" VALUES ("2", "1984", "9", "European Grand Prix", "1984-10-07");
INSERT INTO "races" VALUES ("3", "1985", "8", "European Grand Prix", "1985-10-06");
INSERT INTO "races" VALUES ("4", "1993", "18", "European Grand Prix", "1993-04-11");
INSERT INTO "races" VALUES ("5", "1994", "20", "European Grand Prix", "1994-10-16");
INSERT INTO "races" VALUES ("6", "1995", "9", "European Grand Prix", "1995-10-01");
INSERT INTO "races" VALUES ("7", "1996", "9", "European Grand Prix", "1996-04-28");
INSERT INTO "races" VALUES ("8", "1997", "21", "European Grand Prix", "1997-10-26");
INSERT INTO "races" VALUES ("9", "1999", "17", "European Grand Prix", "1999-09-26");
INSERT INTO "races" VALUES ("10", "2000", "17", "European Grand Prix", "2000-05-21");
INSERT INTO "races" VALUES ("11", "2001", "17", "European Grand Prix", "2001-06-24");
INSERT INTO "races" VALUES ("12", "2002", "17", "European Grand Prix", "2002-06-23");
INSERT INTO "races" VALUES ("13", "2003", "17", "European Grand Prix", "2003-06-29");
INSERT INTO "races" VALUES ("14", "2004", "17", "European Grand Prix", "2004-06-27");
INSERT INTO "races" VALUES ("15", "2005", "17", "European Grand Prix", "2005-05-29");
INSERT INTO "races" VALUES ("16", "2006", "17", "European Grand Prix", "2006-05-07");
INSERT INTO "races" VALUES ("17", "2007", "17", "European Grand Prix", "2007-07-22");
INSERT INTO "races" VALUES ("18", "2008", "54", "European Grand Prix", "2008-08-24");
INSERT INTO "races" VALUES ("19", "2009", "54", "European Grand Prix", "2009-08-23");
INSERT INTO "races" VALUES ("20", "2010", "54", "European Grand Prix", "2010-06-27");
INSERT INTO "races" VALUES ("21", "2011", "54", "European Grand Prix", "2011-06-26");
INSERT INTO "races" VALUES ("22", "2012", "54", "European Grand Prix", "2012-06-24");
INSERT INTO "races" VALUES ("23", "2016", "55", "European Grand Prix", "2016-06-19");
INSERT INTO "races" VALUES ("24", "1950", "38", "British Grand Prix", "1950-05-13");
INSERT INTO "races" VALUES ("25", "1950", "6", "Monaco Grand Prix", "1950-05-21");
INSERT INTO "races" VALUES ("26", "1950", "36", "Indianapolis 500", "1950-05-30");
INSERT INTO "races" VALUES ("27", "1950", "34", "Swiss Grand Prix", "1950-06-04");
INSERT INTO "races" VALUES ("28", "1950", "32", "Belgian Grand Prix", "1950-06-18");
INSERT INTO "races" VALUES ("29", "1950", "24", "French Grand Prix", "1950-07-02");
INSERT INTO "races" VALUES ("30", "1950", "37", "Italian Grand Prix", "1950-09-03");
INSERT INTO "races" VALUES ("31", "1951", "38", "British Grand Prix", "1951-07-14");
INSERT INTO "races" VALUES ("32", "1951", "39", "German Grand Prix", "1951-07-29");
INSERT INTO "races" VALUES ("33", "1951", "37", "Italian Grand Prix", "1951-09-16");
INSERT INTO "races" VALUES ("34", "1952", "38", "British Grand Prix", "1952-07-19");
INSERT INTO "races" VALUES ("35", "1952", "39", "German Grand Prix", "1952-08-03");
INSERT INTO "races" VALUES ("36", "1952", "37", "Italian Grand Prix", "1952-09-07");
INSERT INTO "races" VALUES ("37", "1953", "38", "British Grand Prix", "1953-07-18");
INSERT INTO "races" VALUES ("38", "1953", "39", "German Grand Prix", "1953-08-02");
INSERT INTO "races" VALUES ("39", "1953", "37", "Italian Grand Prix", "1953-09-13");
INSERT INTO "races" VALUES ("40", "1954", "38", "British Grand Prix", "1954-07-17");
INSERT INTO "races" VALUES ("41", "1954", "39", "German Grand Prix", "1954-08-01");
INSERT INTO "races" VALUES ("42", "1954", "37", "Italian Grand Prix", "1954-09-05");
INSERT INTO "races" VALUES ("43", "1955", "38", "British Grand Prix", "1955-07-16");
INSERT INTO "races" VALUES ("44", "1955", "37", "Italian Grand Prix", "1955-09-11");
INSERT INTO "races" VALUES ("45", "1956", "38", "British Grand Prix", "1956-07-14");
INSERT INTO "races" VALUES ("46", "1956", "39", "German Grand Prix", "1956-08-05");
INSERT INTO "races" VALUES ("47", "1956", "37", "Italian Grand Prix", "1956-09-02");
INSERT INTO "races" VALUES ("48", "1957", "38", "British Grand Prix", "1957-07-20");
INSERT INTO "races" VALUES ("49", "1957", "39", "German Grand Prix", "1957-08-04");
INSERT INTO "races" VALUES ("50", "1957", "37", "Italian Grand Prix", "1957-09-08");
INSERT INTO "races" VALUES ("51", "1958", "38", "British Grand Prix", "1958-07-19");
INSERT INTO "races" VALUES ("52", "1958", "39", "German Grand Prix", "1958-08-03");
INSERT INTO "races" VALUES ("53", "1958", "37", "Italian Grand Prix", "1958-09-07");
INSERT INTO "races" VALUES ("54", "1959", "38", "British Grand Prix", "1959-07-18");
INSERT INTO "races" VALUES ("55", "1959", "39", "German Grand Prix", "1959-08-02");
INSERT INTO "races" VALUES ("56", "1959", "37", "Italian Grand Prix", "1959-09-13");
INSERT INTO "races" VALUES ("57", "1960", "38", "British Grand Prix", "1960-07-16");
INSERT INTO "races" VALUES ("58", "1960", "39", "German Grand Prix", "1960-07-31");
INSERT INTO "races" VALUES ("59", "1960", "37", "Italian Grand Prix", "1960-09-04");
INSERT INTO "races" VALUES ("60", "1961", "38", "British Grand Prix", "1961-07-15");
INSERT INTO "races" VALUES ("61", "1961", "39", "German Grand Prix", "1961-08-06");
INSERT INTO "races" VALUES ("62", "1961", "37", "Italian Grand Prix", "1961-09-10");
INSERT INTO "races" VALUES ("63", "1962", "38", "British Grand Prix", "1962-07-21");
INSERT INTO "races" VALUES ("64", "1962", "39", "German Grand Prix", "1962-08-05");
INSERT INTO "races" VALUES ("65", "1962", "37", "Italian Grand Prix", "1962-09-16");
INSERT INTO "races" VALUES ("66", "1963", "38", "British Grand Prix", "1963-07-20");