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,
"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", "Albert Park Grand Prix Circuit", "Australia");
INSERT INTO "circuits" VALUES ("2", "Sepang International Circuit", "Malaysia");
INSERT INTO "circuits" VALUES ("3", "Shanghai International Circuit", "China");
INSERT INTO "circuits" VALUES ("4", "Bahrain International Circuit", "Bahrain");
INSERT INTO "circuits" VALUES ("5", "Circuit de Catalunya", "Spain");
INSERT INTO "circuits" VALUES ("6", "Circuit de Monaco", "Monaco");
INSERT INTO "circuits" VALUES ("7", "Circuit Gilles Villeneuve", "Canada");
INSERT INTO "circuits" VALUES ("8", "Silverstone Circuit", "UK");
INSERT INTO "circuits" VALUES ("9", "Hockenheimring", "Germany");
INSERT INTO "circuits" VALUES ("10", "Hungaroring", "Hungary");
INSERT INTO "circuits" VALUES ("11", "Spa-Francorchamps", "Belgium");
INSERT INTO "circuits" VALUES ("12", "Autodromo Nazionale Monza", "Italy");
INSERT INTO "circuits" VALUES ("13", "Marina Bay Street Circuit", "Singapore");
INSERT INTO "circuits" VALUES ("14", "Suzuka Circuit", "Japan");
INSERT INTO "circuits" VALUES ("15", "Autódromo José Carlos Pace", "Brazil");
INSERT INTO "circuits" VALUES ("16", "Yas Marina Circuit", "UAE");
INSERT INTO "circuits" VALUES ("17", "Korean International Circuit", "South Korea");
INSERT INTO "circuits" VALUES ("18", "Circuit of the Americas", "USA");
INSERT INTO "circuits" VALUES ("19", "Autódromo Hermanos Rodríguez", "Mexico");
INSERT INTO "circuits" VALUES ("20", "Sochi Autodrom", "Russia");
INSERT INTO "circuits" VALUES ("21", "Red Bull Ring", "Austria");
INSERT INTO "circuits" VALUES ("22", "Baku City Circuit", "Azerbaijan");
INSERT INTO "circuits" VALUES ("23", "Jeddah Corniche Circuit", "Saudi Arabia");
INSERT INTO "circuits" VALUES ("24", "Losail International Circuit", "Qatar");
INSERT INTO "circuits" VALUES ("25", "Kyalami Grand Prix Circuit", "South Africa");
INSERT INTO "races" VALUES ("1", "2010", "4", "Bahrain Grand Prix", "2010-03-14");
INSERT INTO "races" VALUES ("2", "2010", "1", "Australian Grand Prix", "2010-03-28");
INSERT INTO "races" VALUES ("3", "2010", "2", "Malaysian Grand Prix", "2010-04-04");
INSERT INTO "races" VALUES ("4", "2010", "3", "Chinese Grand Prix", "2010-04-18");
INSERT INTO "races" VALUES ("5", "2010", "5", "Spanish Grand Prix", "2010-05-09");
INSERT INTO "races" VALUES ("6", "2010", "6", "Monaco Grand Prix", "2010-05-16");
INSERT INTO "races" VALUES ("7", "2010", "8", "British Grand Prix", "2010-07-11");
INSERT INTO "races" VALUES ("8", "2010", "9", "German Grand Prix", "2010-07-25");
INSERT INTO "races" VALUES ("9", "2010", "10", "Hungarian Grand Prix", "2010-08-01");
INSERT INTO "races" VALUES ("10", "2010", "11", "Belgian Grand Prix", "2010-08-29");
INSERT INTO "races" VALUES ("11", "2010", "12", "Italian Grand Prix", "2010-09-12");
INSERT INTO "races" VALUES ("12", "2010", "13", "Singapore Grand Prix", "2010-09-26");
INSERT INTO "races" VALUES ("13", "2010", "14", "Japanese Grand Prix", "2010-10-10");
INSERT INTO "races" VALUES ("14", "2010", "17", "Korean Grand Prix", "2010-10-24");
INSERT INTO "races" VALUES ("15", "2010", "15", "Brazilian Grand Prix", "2010-11-07");
INSERT INTO "races" VALUES ("16", "2010", "16", "Abu Dhabi Grand Prix", "2010-11-14");
INSERT INTO "races" VALUES ("17", "2010", "7", "Canadian Grand Prix", "2010-06-13");
INSERT INTO "races" VALUES ("18", "2011", "1", "Australian Grand Prix", "2011-03-27");
INSERT INTO "races" VALUES ("19", "2011", "5", "Spanish Grand Prix", "2011-05-22");
INSERT INTO "races" VALUES ("20", "2009", "1", "Australian Grand Prix", "2009-03-29");
INSERT INTO "races" VALUES ("21", "2010", "25", "South African Grand Prix", "2010-04-25");