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,
"name" TEXT,
PRIMARY KEY ("circuitId")
);

CREATE TABLE "races" (
"raceId" INT,
"year" INT,
"name" TEXT,
"date" DATE,
PRIMARY KEY ("raceId"),
FOREIGN KEY ("year") REFERENCES "seasons"("year")
);

CREATE TABLE "seasons" (
"year" INT UNIQUE,
"url" TEXT,
PRIMARY KEY ("year")
);



INSERT INTO "circuits" VALUES ("1", "Bahrain International Circuit");
INSERT INTO "circuits" VALUES ("2", "Melbourne Grand Prix Circuit");
INSERT INTO "circuits" VALUES ("3", "Shanghai International Circuit");
INSERT INTO "circuits" VALUES ("4", "Baku City Circuit");
INSERT INTO "circuits" VALUES ("5", "Circuit de Barcelona-Catalunya");
INSERT INTO "circuits" VALUES ("6", "Circuit de Monaco");
INSERT INTO "circuits" VALUES ("7", "Circuit Gilles Villeneuve");
INSERT INTO "circuits" VALUES ("8", "Circuit Paul Ricard");
INSERT INTO "circuits" VALUES ("9", "Red Bull Ring");
INSERT INTO "circuits" VALUES ("10", "Silverstone Circuit");
INSERT INTO "seasons" VALUES ("2018", "http://en.wikipedia.org/wiki/2018_Formula_One_season");
INSERT INTO "seasons" VALUES ("2019", "http://en.wikipedia.org/wiki/2019_Formula_One_season");
INSERT INTO "seasons" VALUES ("2020", "http://en.wikipedia.org/wiki/2020_Formula_One_season");
INSERT INTO "seasons" VALUES ("2021", "http://en.wikipedia.org/wiki/2021_Formula_One_season");
INSERT INTO "seasons" VALUES ("2022", "http://en.wikipedia.org/wiki/2022_Formula_One_season");
INSERT INTO "seasons" VALUES ("2023", "http://en.wikipedia.org/wiki/2023_Formula_One_season");
INSERT INTO "races" VALUES ("900", "2018", "Australian Grand Prix", "2018-03-25");
INSERT INTO "races" VALUES ("901", "2018", "Bahrain Grand Prix", "2018-04-08");
INSERT INTO "races" VALUES ("902", "2018", "Chinese Grand Prix", "2018-04-15");
INSERT INTO "races" VALUES ("903", "2019", "Azerbaijan Grand Prix", "2019-04-28");
INSERT INTO "races" VALUES ("904", "2019", "Spanish Grand Prix", "2019-05-12");
INSERT INTO "races" VALUES ("905", "2020", "Monaco Grand Prix", "2020-05-24");
INSERT INTO "races" VALUES ("906", "2020", "Canadian Grand Prix", "2020-06-14");
INSERT INTO "races" VALUES ("907", "2021", "French Grand Prix", "2021-06-20");
INSERT INTO "races" VALUES ("908", "2021", "Austrian Grand Prix", "2021-07-04");
INSERT INTO "races" VALUES ("909", "2022", "British Grand Prix", "2022-07-03");
INSERT INTO "races" VALUES ("910", "2023", "Hungarian Grand Prix", "2023-07-23");