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,
"lat" FLOAT,
"lng" FLOAT,
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", "Albert Park Grand Prix Circuit", "Australia", "-37.8497", "144.968");
INSERT INTO "circuits" VALUES ("2", "Silverstone Circuit", "United Kingdom", "52.0786", "-1.0169");
INSERT INTO "circuits" VALUES ("3", "Circuit de Monaco", "Monaco", "43.7347", "7.4206");
INSERT INTO "circuits" VALUES ("4", "Suzuka Circuit", "Japan", "34.8431", "136.541");
INSERT INTO "circuits" VALUES ("5", "Circuit Gilles Villeneuve", "Canada", "45.5", "-73.5228");
INSERT INTO "circuits" VALUES ("6", "Marina Bay Street Circuit", "Singapore", "1.2914", "103.864");
INSERT INTO "circuits" VALUES ("7", "Melbourne Grand Prix Circuit", "Australia", "-37.8496", "144.9681");
INSERT INTO "races" VALUES ("101", "2018", "1", "Australian Grand Prix");
INSERT INTO "races" VALUES ("102", "2019", "1", "Australian Grand Prix");
INSERT INTO "races" VALUES ("103", "2020", "7", "Australian Grand Prix");
INSERT INTO "races" VALUES ("104", "2018", "2", "British Grand Prix");
INSERT INTO "races" VALUES ("105", "2019", "3", "Monaco Grand Prix");
INSERT INTO "races" VALUES ("106", "2020", "4", "Japanese Grand Prix");
INSERT INTO "races" VALUES ("107", "2019", "5", "Canadian Grand Prix");
INSERT INTO "races" VALUES ("108", "2020", "6", "Singapore Grand Prix");
INSERT INTO "races" VALUES ("109", "2021", "7", "Australian Grand Prix");