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 "constructorResults" (
"constructorResultsId" INT,
"points" FLOAT,
PRIMARY KEY ("constructorResultsId")
);

CREATE TABLE "circuits" (
"circuitId" INT UNIQUE,
"name" TEXT,
"location" TEXT,
"country" TEXT,
"lat" FLOAT,
"lng" FLOAT,
PRIMARY KEY ("circuitId")
);

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

CREATE TABLE "races" (
"raceId" INT UNIQUE,
"year" INT,
"circuitId" INT,
PRIMARY KEY ("raceId"),
FOREIGN KEY ("circuitId") REFERENCES "circuits"("circuitId")
);



INSERT INTO "constructorResults" VALUES ("1", "10.0");
INSERT INTO "constructorResults" VALUES ("2", "15.0");
INSERT INTO "constructorResults" VALUES ("3", "25.0");
INSERT INTO "constructorResults" VALUES ("4", "0.0");
INSERT INTO "constructorResults" VALUES ("5", "12.0");
INSERT INTO "constructorResults" VALUES ("6", "8.0");
INSERT INTO "constructorResults" VALUES ("7", "5.0");
INSERT INTO "constructorResults" VALUES ("8", "2.0");
INSERT INTO "constructorResults" VALUES ("9", "1.0");
INSERT INTO "constructorResults" VALUES ("10", "0.0");
INSERT INTO "circuits" VALUES ("1", "Red Bull Ring", "Spielberg", "Austria", "47.2197", "14.7647");
INSERT INTO "circuits" VALUES ("2", "Silverstone Circuit", "Silverstone", "UK", "52.0786", "-1.0169");
INSERT INTO "circuits" VALUES ("3", "Monza", "Monza", "Italy", "45.6156", "9.2811");
INSERT INTO "circuits" VALUES ("4", "Circuit de Barcelona-Catalunya", "Montmelo", "Spain", "41.57", "2.26");
INSERT INTO "circuits" VALUES ("5", "Hungaroring", "Mogyorod", "Hungary", "47.5789", "19.2511");
INSERT INTO "circuits" VALUES ("6", "Circuit Gilles Villeneuve", "Montreal", "Canada", "45.5008", "-73.5228");
INSERT INTO "circuits" VALUES ("7", "Spa-Francorchamps", "Stavelot", "Belgium", "50.4361", "5.9714");
INSERT INTO "circuits" VALUES ("8", "Hockenheimring", "Hockenheim", "Germany", "49.3278", "8.5658");
INSERT INTO "circuits" VALUES ("9", "Autodromo Jose Carlos Pace", "Sao Paulo", "Brazil", "-23.7036", "-46.6997");
INSERT INTO "circuits" VALUES ("10", "Yas Marina Circuit", "Abu Dhabi", "UAE", "24.4672", "54.6031");
INSERT INTO "circuits" VALUES ("11", "Osterreichring", "Zeltweg", "Austria", "47.2197", "14.7647");
INSERT INTO "circuits" VALUES ("12", "A1-Ring", "Spielberg", "Austria", "47.2197", "14.7647");
INSERT INTO "constructors" VALUES ("1", "Mercedes");
INSERT INTO "constructors" VALUES ("2", "Red Bull");
INSERT INTO "constructors" VALUES ("3", "Ferrari");
INSERT INTO "constructors" VALUES ("4", "McLaren");
INSERT INTO "constructors" VALUES ("5", "Aston Martin");
INSERT INTO "constructors" VALUES ("6", "Alpine");
INSERT INTO "constructors" VALUES ("7", "AlphaTauri");
INSERT INTO "constructors" VALUES ("8", "Sauber");
INSERT INTO "constructors" VALUES ("9", "Haas F1 Team");
INSERT INTO "constructors" VALUES ("10", "Williams");
INSERT INTO "races" VALUES ("1", "2023", "1");
INSERT INTO "races" VALUES ("2", "2023", "2");
INSERT INTO "races" VALUES ("3", "2023", "3");
INSERT INTO "races" VALUES ("4", "2022", "1");
INSERT INTO "races" VALUES ("5", "2022", "4");
INSERT INTO "races" VALUES ("6", "2022", "5");
INSERT INTO "races" VALUES ("7", "2021", "1");
INSERT INTO "races" VALUES ("8", "2021", "6");
INSERT INTO "races" VALUES ("9", "2021", "7");
INSERT INTO "races" VALUES ("10", "2020", "1");
INSERT INTO "races" VALUES ("11", "2020", "8");
INSERT INTO "races" VALUES ("12", "2019", "1");
INSERT INTO "races" VALUES ("13", "2019", "9");
INSERT INTO "races" VALUES ("14", "2018", "1");
INSERT INTO "races" VALUES ("15", "2018", "10");
INSERT INTO "races" VALUES ("16", "1970", "11");
INSERT INTO "races" VALUES ("17", "1971", "11");
INSERT INTO "races" VALUES ("18", "1997", "12");
INSERT INTO "races" VALUES ("19", "1998", "12");
INSERT INTO "races" VALUES ("20", "2023", "2");