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



INSERT INTO "circuits" VALUES ("1", "Circuit de Monaco", "Monte Carlo", "Monaco");
INSERT INTO "circuits" VALUES ("2", "Nürburgring", "Nürburg", "Germany");
INSERT INTO "circuits" VALUES ("3", "Hockenheimring", "Hockenheim", "Germany");
INSERT INTO "circuits" VALUES ("4", "Circuit de Spa-Francorchamps", "Stavelot", "Belgium");
INSERT INTO "circuits" VALUES ("5", "Silverstone Circuit", "Silverstone", "UK");
INSERT INTO "circuits" VALUES ("6", "Circuit de Catalunya", "Montmeló", "Spain");
INSERT INTO "circuits" VALUES ("7", "Autodromo Nazionale Monza", "Monza", "Italy");
INSERT INTO "circuits" VALUES ("8", "Hungaroring", "Mogyoród", "Hungary");
INSERT INTO "circuits" VALUES ("9", "Red Bull Ring", "Spielberg", "Austria");
INSERT INTO "circuits" VALUES ("10", "Istanbul Park", "Istanbul", "Turkey");
INSERT INTO "races" VALUES ("1", "1", "Monaco Grand Prix", "2023-05-28");
INSERT INTO "races" VALUES ("2", "2", "European Grand Prix", "2013-07-07");
INSERT INTO "races" VALUES ("3", "3", "German Grand Prix", "2019-07-28");
INSERT INTO "races" VALUES ("4", "4", "Belgian Grand Prix", "2023-07-30");
INSERT INTO "races" VALUES ("5", "5", "British Grand Prix", "2023-07-09");
INSERT INTO "races" VALUES ("6", "2", "European Grand Prix", "2012-06-24");
INSERT INTO "races" VALUES ("7", "6", "Spanish Grand Prix", "2023-06-04");
INSERT INTO "races" VALUES ("8", "7", "Italian Grand Prix", "2023-09-03");
INSERT INTO "races" VALUES ("9", "8", "Hungarian Grand Prix", "2023-07-23");
INSERT INTO "races" VALUES ("10", "9", "Austrian Grand Prix", "2023-07-02");
INSERT INTO "races" VALUES ("11", "10", "European Grand Prix", "2011-06-26");
INSERT INTO "races" VALUES ("12", "2", "European Grand Prix", "2007-07-22");
INSERT INTO "races" VALUES ("13", "6", "European Grand Prix", "1994-10-16");
INSERT INTO "races" VALUES ("14", "3", "European Grand Prix", "1999-09-26");
INSERT INTO "races" VALUES ("15", "2", "European Grand Prix", "2009-07-12");