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,
"location" TEXT,
"country" TEXT,
"lat" FLOAT,
"lng" FLOAT,
PRIMARY KEY ("circuitId")
);

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



INSERT INTO "circuits" VALUES ("1", "Hungaroring", "Mogyoród", "Hungary", "47.5789", "19.2486");
INSERT INTO "circuits" VALUES ("2", "Silverstone Circuit", "Silverstone", "UK", "52.0786", "-1.01694");
INSERT INTO "circuits" VALUES ("3", "Circuit de Monaco", "Monte Carlo", "Monaco", "43.7347", "7.42056");
INSERT INTO "circuits" VALUES ("4", "Autodromo Nazionale Monza", "Monza", "Italy", "45.6156", "9.28111");
INSERT INTO "circuits" VALUES ("5", "Circuit de Spa-Francorchamps", "Spa", "Belgium", "50.4372", "5.97139");
INSERT INTO "circuits" VALUES ("6", "Suzuka Circuit", "Suzuka", "Japan", "34.8431", "136.538");
INSERT INTO "circuits" VALUES ("7", "Circuit of the Americas", "Austin", "USA", "30.1328", "-97.6411");
INSERT INTO "circuits" VALUES ("8", "Yas Marina Circuit", "Abu Dhabi", "UAE", "24.4672", "54.6031");
INSERT INTO "circuits" VALUES ("9", "Shanghai International Circuit", "Shanghai", "China", "31.3389", "121.22");
INSERT INTO "circuits" VALUES ("10", "Bahrain International Circuit", "Sakhir", "Bahrain", "26.0325", "50.5106");
INSERT INTO "races" VALUES ("1", "2023", "Hungarian Grand Prix", "2023-07-23");
INSERT INTO "races" VALUES ("2", "2023", "British Grand Prix", "2023-07-09");
INSERT INTO "races" VALUES ("3", "2023", "Monaco Grand Prix", "2023-05-28");
INSERT INTO "races" VALUES ("4", "2023", "Italian Grand Prix", "2023-09-03");
INSERT INTO "races" VALUES ("5", "2022", "Belgian Grand Prix", "2022-08-28");
INSERT INTO "races" VALUES ("6", "2022", "Japanese Grand Prix", "2022-10-09");
INSERT INTO "races" VALUES ("7", "2021", "United States Grand Prix", "2021-10-24");
INSERT INTO "races" VALUES ("8", "2021", "Abu Dhabi Grand Prix", "2021-12-12");
INSERT INTO "races" VALUES ("9", "2020", "Chinese Grand Prix", "2020-04-19");
INSERT INTO "races" VALUES ("10", "2020", "Bahrain Grand Prix", "2020-11-29");