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", "Bahrain International Circuit", "Bahrain");
INSERT INTO "circuits" VALUES ("4", "Circuit de Catalunya", "Spain");
INSERT INTO "circuits" VALUES ("5", "Circuit de Monaco", "Monaco");
INSERT INTO "circuits" VALUES ("6", "Circuit Gilles Villeneuve", "Canada");
INSERT INTO "circuits" VALUES ("7", "Silverstone Circuit", "UK");
INSERT INTO "circuits" VALUES ("8", "Hockenheimring", "Germany");
INSERT INTO "circuits" VALUES ("9", "Hungaroring", "Hungary");
INSERT INTO "circuits" VALUES ("10", "Spa-Francorchamps", "Belgium");
INSERT INTO "circuits" VALUES ("11", "Autodromo Nazionale Monza", "Italy");
INSERT INTO "circuits" VALUES ("12", "Marina Bay Street Circuit", "Singapore");
INSERT INTO "circuits" VALUES ("13", "Suzuka Circuit", "Japan");
INSERT INTO "circuits" VALUES ("14", "Autódromo José Carlos Pace", "Brazil");
INSERT INTO "circuits" VALUES ("15", "Yas Marina Circuit", "UAE");
INSERT INTO "circuits" VALUES ("16", "Nürburgring", "Germany");
INSERT INTO "circuits" VALUES ("17", "Red Bull Ring", "Austria");
INSERT INTO "circuits" VALUES ("18", "Circuit of the Americas", "USA");
INSERT INTO "circuits" VALUES ("19", "Sochi Autodrom", "Russia");
INSERT INTO "circuits" VALUES ("20", "Autódromo Hermanos Rodríguez", "Mexico");
INSERT INTO "races" VALUES ("1", "2023", "1", "Australian Grand Prix", "2023-03-05");
INSERT INTO "races" VALUES ("2", "2023", "3", "Bahrain Grand Prix", "2023-03-19");
INSERT INTO "races" VALUES ("3", "2023", "4", "Spanish Grand Prix", "2023-05-28");
INSERT INTO "races" VALUES ("4", "2023", "8", "German Grand Prix", "2023-07-23");
INSERT INTO "races" VALUES ("5", "2023", "11", "Italian Grand Prix", "2023-09-03");
INSERT INTO "races" VALUES ("6", "2022", "1", "Australian Grand Prix", "2022-04-10");
INSERT INTO "races" VALUES ("7", "2022", "16", "Eifel Grand Prix", "2022-10-11");
INSERT INTO "races" VALUES ("8", "2022", "10", "Belgian Grand Prix", "2022-08-28");
INSERT INTO "races" VALUES ("9", "2021", "8", "German Grand Prix", "2021-08-01");
INSERT INTO "races" VALUES ("10", "2021", "13", "Japanese Grand Prix", "2021-10-10");
INSERT INTO "races" VALUES ("11", "2020", "16", "70th Anniversary Grand Prix", "2020-08-09");
INSERT INTO "races" VALUES ("12", "2019", "8", "German Grand Prix", "2019-07-28");
INSERT INTO "races" VALUES ("13", "2018", "7", "British Grand Prix", "2018-07-08");
INSERT INTO "races" VALUES ("14", "2018", "8", "German Grand Prix", "2018-07-22");
INSERT INTO "races" VALUES ("15", "2017", "16", "German Grand Prix", "2017-07-30");
INSERT INTO "races" VALUES ("16", "2016", "8", "German Grand Prix", "2016-07-31");
INSERT INTO "races" VALUES ("17", "2015", "11", "Italian Grand Prix", "2015-09-06");
INSERT INTO "races" VALUES ("18", "2014", "8", "German Grand Prix", "2014-07-20");
INSERT INTO "races" VALUES ("19", "2013", "16", "German Grand Prix", "2013-07-07");
INSERT INTO "races" VALUES ("20", "2012", "8", "German Grand Prix", "2012-07-22");