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



INSERT INTO "circuits" VALUES ("1", "Albert Park Grand Prix Circuit", "Melbourne", "Australia");
INSERT INTO "circuits" VALUES ("2", "Sepang International Circuit", "Kuala Lumpur", "Malaysia");
INSERT INTO "circuits" VALUES ("3", "Shanghai International Circuit", "Shanghai", "China");
INSERT INTO "circuits" VALUES ("4", "Bahrain International Circuit", "Sakhir", "Bahrain");
INSERT INTO "circuits" VALUES ("5", "Circuit de Barcelona-Catalunya", "Montmeló", "Spain");
INSERT INTO "circuits" VALUES ("6", "Circuit de Monaco", "Monte Carlo", "Monaco");
INSERT INTO "circuits" VALUES ("7", "Circuit Gilles Villeneuve", "Montreal", "Canada");
INSERT INTO "circuits" VALUES ("8", "Red Bull Ring", "Spielberg", "Austria");
INSERT INTO "circuits" VALUES ("9", "Silverstone Circuit", "Silverstone", "UK");
INSERT INTO "circuits" VALUES ("10", "Hockenheimring", "Hockenheim", "Germany");
INSERT INTO "circuits" VALUES ("11", "Hungaroring", "Mogyoród", "Hungary");
INSERT INTO "circuits" VALUES ("12", "Circuit de Spa-Francorchamps", "Stavelot", "Belgium");
INSERT INTO "circuits" VALUES ("13", "Autodromo Nazionale Monza", "Monza", "Italy");
INSERT INTO "circuits" VALUES ("14", "Marina Bay Street Circuit", "Marina Bay", "Singapore");
INSERT INTO "circuits" VALUES ("15", "Suzuka International Racing Course", "Suzuka", "Japan");
INSERT INTO "circuits" VALUES ("16", "Circuit of the Americas", "Austin", "USA");
INSERT INTO "circuits" VALUES ("17", "Autódromo Hermanos Rodríguez", "Mexico City", "Mexico");
INSERT INTO "circuits" VALUES ("18", "Autódromo José Carlos Pace", "São Paulo", "Brazil");
INSERT INTO "circuits" VALUES ("19", "Yas Marina Circuit", "Abu Dhabi", "UAE");
INSERT INTO "circuits" VALUES ("20", "Adelaide Street Circuit", "Adelaide", "Australia");
INSERT INTO "circuits" VALUES ("21", "Kyalami", "Midrand", "South Africa");
INSERT INTO "circuits" VALUES ("22", "Brands Hatch", "Fawkham", "UK");
INSERT INTO "circuits" VALUES ("23", "Donington Park", "Castle Donington", "UK");
INSERT INTO "circuits" VALUES ("24", "Fuji Speedway", "Oyama", "Japan");
INSERT INTO "circuits" VALUES ("25", "Imola", "Imola", "Italy");
INSERT INTO "circuits" VALUES ("26", "Nürburgring", "Nürburg", "Germany");
INSERT INTO "circuits" VALUES ("27", "Paul Ricard", "Le Castellet", "France");
INSERT INTO "circuits" VALUES ("28", "Zandvoort", "Zandvoort", "Netherlands");
INSERT INTO "circuits" VALUES ("29", "Adelaide International Raceway", "Adelaide", "Australia");
INSERT INTO "circuits" VALUES ("30", "Sydney Motorsport Park", "Eastern Creek", "Australia");
INSERT INTO "races" VALUES ("1", "1", "Australian Grand Prix");
INSERT INTO "races" VALUES ("2", "20", "Australian Grand Prix");
INSERT INTO "races" VALUES ("3", "29", "Australian Grand Prix");
INSERT INTO "races" VALUES ("4", "2", "Malaysian Grand Prix");
INSERT INTO "races" VALUES ("5", "3", "Chinese Grand Prix");
INSERT INTO "races" VALUES ("6", "4", "Bahrain Grand Prix");
INSERT INTO "races" VALUES ("7", "5", "Spanish Grand Prix");
INSERT INTO "races" VALUES ("8", "6", "Monaco Grand Prix");
INSERT INTO "races" VALUES ("9", "7", "Canadian Grand Prix");
INSERT INTO "races" VALUES ("10", "8", "Austrian Grand Prix");
INSERT INTO "races" VALUES ("11", "9", "British Grand Prix");
INSERT INTO "races" VALUES ("12", "10", "German Grand Prix");
INSERT INTO "races" VALUES ("13", "11", "Hungarian Grand Prix");
INSERT INTO "races" VALUES ("14", "12", "Belgian Grand Prix");
INSERT INTO "races" VALUES ("15", "13", "Italian Grand Prix");
INSERT INTO "races" VALUES ("16", "14", "Singapore Grand Prix");
INSERT INTO "races" VALUES ("17", "15", "Japanese Grand Prix");
INSERT INTO "races" VALUES ("18", "16", "United States Grand Prix");
INSERT INTO "races" VALUES ("19", "17", "Mexican Grand Prix");
INSERT INTO "races" VALUES ("20", "18", "Brazilian Grand Prix");
INSERT INTO "races" VALUES ("21", "19", "Abu Dhabi Grand Prix");
INSERT INTO "races" VALUES ("22", "21", "South African Grand Prix");
INSERT INTO "races" VALUES ("23", "22", "British Grand Prix");
INSERT INTO "races" VALUES ("24", "23", "European Grand Prix");
INSERT INTO "races" VALUES ("25", "24", "Japanese Grand Prix");
INSERT INTO "races" VALUES ("26", "25", "San Marino Grand Prix");
INSERT INTO "races" VALUES ("27", "26", "European Grand Prix");
INSERT INTO "races" VALUES ("28", "27", "French Grand Prix");
INSERT INTO "races" VALUES ("29", "28", "Dutch Grand Prix");
INSERT INTO "races" VALUES ("30", "30", "Australian Supercars");