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,
"year" INT,
"round" INT,
"circuitId" INT,
"date" DATE,
PRIMARY KEY ("raceId"),
FOREIGN KEY ("circuitId") REFERENCES "circuits"("circuitId")
);



INSERT INTO "circuits" VALUES ("1", "Monaco Grand Prix Circuit", "Monte Carlo", "Europe");
INSERT INTO "circuits" VALUES ("2", "Suzuka Circuit", "Suzuka", "Asia");
INSERT INTO "circuits" VALUES ("3", "Circuit of the Americas", "Austin", "North America");
INSERT INTO "circuits" VALUES ("4", "Interlagos", "São Paulo", "South America");
INSERT INTO "circuits" VALUES ("5", "Albert Park Circuit", "Melbourne", "Australia");
INSERT INTO "circuits" VALUES ("6", "Yas Marina Circuit", "Abu Dhabi", "Asia");
INSERT INTO "circuits" VALUES ("7", "Silverstone Circuit", "Silverstone", "Europe");
INSERT INTO "circuits" VALUES ("8", "Marina Bay Street Circuit", "Singapore", "Asia");
INSERT INTO "circuits" VALUES ("9", "Bahrain International Circuit", "Sakhir", "Asia");
INSERT INTO "circuits" VALUES ("10", "Circuit Gilles Villeneuve", "Montreal", "North America");
INSERT INTO "races" VALUES ("101", "2010", "1", "3", "2010-03-14");
INSERT INTO "races" VALUES ("102", "2010", "2", "4", "2010-03-28");
INSERT INTO "races" VALUES ("103", "2010", "3", "5", "2010-04-11");
INSERT INTO "races" VALUES ("104", "2010", "4", "1", "2010-05-09");
INSERT INTO "races" VALUES ("105", "2010", "5", "7", "2010-06-13");
INSERT INTO "races" VALUES ("106", "2010", "6", "2", "2010-10-10");
INSERT INTO "races" VALUES ("107", "2010", "7", "6", "2010-11-14");
INSERT INTO "races" VALUES ("108", "2010", "8", "8", "2010-09-26");
INSERT INTO "races" VALUES ("109", "2010", "9", "9", "2010-04-25");
INSERT INTO "races" VALUES ("110", "2010", "10", "10", "2010-06-20");
INSERT INTO "races" VALUES ("111", "2010", "11", "3", "2010-11-07");
INSERT INTO "races" VALUES ("112", "2011", "1", "3", "2011-03-27");