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,
"url" 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", "http://en.wikipedia.org/wiki/Albert_Park_Circuit");
INSERT INTO "circuits" VALUES ("2", "http://en.wikipedia.org/wiki/Sepang_International_Circuit");
INSERT INTO "circuits" VALUES ("3", "http://en.wikipedia.org/wiki/Bahrain_International_Circuit");
INSERT INTO "circuits" VALUES ("4", "http://en.wikipedia.org/wiki/Circuit_de_Catalunya");
INSERT INTO "circuits" VALUES ("5", "http://en.wikipedia.org/wiki/Circuit_de_Monaco");
INSERT INTO "circuits" VALUES ("6", "http://en.wikipedia.org/wiki/Circuit_Gilles_Villeneuve");
INSERT INTO "circuits" VALUES ("7", "http://en.wikipedia.org/wiki/Silverstone_Circuit");
INSERT INTO "circuits" VALUES ("8", "http://en.wikipedia.org/wiki/Hockenheimring");
INSERT INTO "circuits" VALUES ("9", "http://en.wikipedia.org/wiki/Hungaroring");
INSERT INTO "circuits" VALUES ("10", "http://en.wikipedia.org/wiki/Circuit_de_Spa-Francorchamps");
INSERT INTO "circuits" VALUES ("11", "http://en.wikipedia.org/wiki/Autodromo_Nazionale_Monza");
INSERT INTO "circuits" VALUES ("12", "http://en.wikipedia.org/wiki/Marina_Bay_Street_Circuit");
INSERT INTO "circuits" VALUES ("13", "http://en.wikipedia.org/wiki/Suzuka_Circuit");
INSERT INTO "circuits" VALUES ("14", "http://en.wikipedia.org/wiki/Aut%C3%B3dromo_Jos%C3%A9_Carlos_Pace");
INSERT INTO "circuits" VALUES ("15", "http://en.wikipedia.org/wiki/Yas_Marina_Circuit");
INSERT INTO "races" VALUES ("1", "2009", "1", "Australian Grand Prix");
INSERT INTO "races" VALUES ("2", "2009", "2", "Malaysian Grand Prix");
INSERT INTO "races" VALUES ("3", "2009", "3", "Bahrain Grand Prix");
INSERT INTO "races" VALUES ("4", "2009", "4", "Spanish Grand Prix");
INSERT INTO "races" VALUES ("5", "2009", "5", "Monaco Grand Prix");
INSERT INTO "races" VALUES ("6", "2009", "6", "Canadian Grand Prix");
INSERT INTO "races" VALUES ("7", "2009", "7", "British Grand Prix");
INSERT INTO "races" VALUES ("8", "2009", "8", "German Grand Prix");
INSERT INTO "races" VALUES ("9", "2009", "9", "Hungarian Grand Prix");
INSERT INTO "races" VALUES ("10", "2009", "10", "European Grand Prix");
INSERT INTO "races" VALUES ("11", "2009", "11", "Belgian Grand Prix");
INSERT INTO "races" VALUES ("12", "2009", "12", "Italian Grand Prix");
INSERT INTO "races" VALUES ("13", "2009", "13", "Singapore Grand Prix");
INSERT INTO "races" VALUES ("14", "2009", "14", "Japanese Grand Prix");
INSERT INTO "races" VALUES ("15", "2009", "15", "Brazilian Grand Prix");
INSERT INTO "races" VALUES ("16", "2009", "15", "Abu Dhabi Grand Prix");
INSERT INTO "races" VALUES ("17", "2010", "4", "Spanish Grand Prix");
INSERT INTO "races" VALUES ("18", "2008", "4", "Spanish Grand Prix");
INSERT INTO "races" VALUES ("19", "2009", "1", "Another Grand Prix");
INSERT INTO "races" VALUES ("20", "2009", "2", "Spanish Grand Prix");