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

CREATE TABLE "constructors" (
"constructorId" INT,
"nationality" TEXT,
PRIMARY KEY ("constructorId")
);

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



INSERT INTO "circuits" VALUES ("1", "Silverstone Circuit", "Silverstone", "United Kingdom", "52.0786", "-1.0169");
INSERT INTO "circuits" VALUES ("2", "Circuit de Monaco", "Monte Carlo", "Monaco", "43.7347", "7.4206");
INSERT INTO "circuits" VALUES ("3", "Hungaroring", "Mogyoród", "Hungary", "47.5789", "19.2486");
INSERT INTO "circuits" VALUES ("4", "Circuit Gilles Villeneuve", "Montreal", "Canada", "45.5", "-73.5228");
INSERT INTO "circuits" VALUES ("5", "Suzuka Circuit", "Suzuka", "Japan", "34.8431", "136.5419");
INSERT INTO "constructors" VALUES ("1", "British");
INSERT INTO "constructors" VALUES ("2", "Italian");
INSERT INTO "constructors" VALUES ("3", "Hungarian");
INSERT INTO "constructors" VALUES ("4", "Canadian");
INSERT INTO "constructors" VALUES ("5", "Japanese");
INSERT INTO "races" VALUES ("1", "2023-07-23");
INSERT INTO "races" VALUES ("2", "2023-05-28");
INSERT INTO "races" VALUES ("3", "2023-08-06");
INSERT INTO "races" VALUES ("4", "2023-06-18");
INSERT INTO "races" VALUES ("5", "2023-09-03");