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,
"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", "-37.8497", "144.968");
INSERT INTO "circuits" VALUES ("2", "Sepang International Circuit", "Malaysia", "2.76083", "101.738");
INSERT INTO "circuits" VALUES ("3", "Bahrain International Circuit", "Bahrain", "26.0325", "50.5106");
INSERT INTO "circuits" VALUES ("4", "Circuit de Barcelona-Catalunya", "Spain", "41.57", "2.26111");
INSERT INTO "circuits" VALUES ("5", "Circuit de Monaco", "Monaco", "43.7347", "7.42056");
INSERT INTO "circuits" VALUES ("6", "Circuit Gilles Villeneuve", "Canada", "45.5", "-73.5228");
INSERT INTO "circuits" VALUES ("7", "Silverstone Circuit", "UK", "52.0786", "-1.01694");
INSERT INTO "circuits" VALUES ("8", "Hockenheimring", "Germany", "49.3278", "8.56583");
INSERT INTO "circuits" VALUES ("9", "Hungaroring", "Hungary", "47.5789", "19.2506");
INSERT INTO "circuits" VALUES ("10", "Spa-Francorchamps", "Belgium", "50.4394", "5.97139");
INSERT INTO "circuits" VALUES ("11", "Autodromo Nazionale di Monza", "Italy", "45.6156", "9.28111");
INSERT INTO "circuits" VALUES ("12", "Marina Bay Street Circuit", "Singapore", "1.29167", "103.864");
INSERT INTO "circuits" VALUES ("13", "Suzuka Circuit", "Japan", "34.8431", "136.538");
INSERT INTO "circuits" VALUES ("14", "Yas Marina Circuit", "UAE", "24.4672", "54.6031");
INSERT INTO "circuits" VALUES ("15", "Autódromo José Carlos Pace", "Brazil", "-23.7036", "-46.6997");
INSERT INTO "circuits" VALUES ("16", "Circuit of the Americas", "USA", "30.1328", "-97.6411");
INSERT INTO "circuits" VALUES ("17", "Sochi Autodrom", "Russia", "43.4057", "39.9578");
INSERT INTO "circuits" VALUES ("18", "Autódromo Hermanos Rodríguez", "Mexico", "19.4042", "-99.0917");
INSERT INTO "circuits" VALUES ("19", "Baku City Circuit", "Azerbaijan", "40.3725", "49.8533");
INSERT INTO "circuits" VALUES ("20", "Red Bull Ring", "Austria", "47.2197", "14.7647");
INSERT INTO "races" VALUES ("1", "1", "Australian Grand Prix", "2023-03-05");
INSERT INTO "races" VALUES ("2", "3", "Bahrain Grand Prix", "2023-03-19");
INSERT INTO "races" VALUES ("3", "12", "Singapore Grand Prix", "2023-09-17");
INSERT INTO "races" VALUES ("4", "14", "Abu Dhabi Grand Prix", "2023-11-26");
INSERT INTO "races" VALUES ("5", "5", "Monaco Grand Prix", "2023-05-28");
INSERT INTO "races" VALUES ("6", "7", "British Grand Prix", "2023-07-09");
INSERT INTO "races" VALUES ("7", "11", "Italian Grand Prix", "2023-09-03");
INSERT INTO "races" VALUES ("8", "16", "United States Grand Prix", "2023-10-22");
INSERT INTO "races" VALUES ("9", "18", "Mexican Grand Prix", "2023-10-29");
INSERT INTO "races" VALUES ("10", "19", "Azerbaijan Grand Prix", "2023-04-30");
INSERT INTO "races" VALUES ("11", "14", "Abu Dhabi Grand Prix", "2022-11-20");
INSERT INTO "races" VALUES ("12", "14", "Abu Dhabi Grand Prix", "2021-12-12");
INSERT INTO "races" VALUES ("13", "1", "Australian Grand Prix", "2022-04-10");
INSERT INTO "races" VALUES ("14", "3", "Bahrain Grand Prix", "2022-03-20");