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,
"constructorId" INT,
"points" FLOAT,
PRIMARY KEY ("constructorResultsId"),
FOREIGN KEY ("constructorId") REFERENCES "constructors"("constructorId")
);

CREATE TABLE "constructorStandings" (
"constructorStandingsId" INT,
"raceId" INT,
"constructorId" INT,
"points" FLOAT,
"wins" INT,
PRIMARY KEY ("constructorStandingsId"),
FOREIGN KEY ("constructorId") REFERENCES "constructors"("constructorId")
);

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



INSERT INTO "constructors" VALUES ("1", "Mercedes", "German");
INSERT INTO "constructors" VALUES ("2", "Red Bull", "Austrian");
INSERT INTO "constructors" VALUES ("3", "Ferrari", "Italian");
INSERT INTO "constructors" VALUES ("4", "McLaren", "British");
INSERT INTO "constructors" VALUES ("5", "Aston Martin", "British");
INSERT INTO "constructors" VALUES ("6", "Alpine", "French");
INSERT INTO "constructors" VALUES ("7", "Williams", "British");
INSERT INTO "constructors" VALUES ("8", "Haas", "American");
INSERT INTO "constructors" VALUES ("9", "AlphaTauri", "Italian");
INSERT INTO "constructors" VALUES ("10", "Sauber", "Swiss");
INSERT INTO "constructorResults" VALUES ("1", "1", "50.0");
INSERT INTO "constructorResults" VALUES ("2", "2", "45.0");
INSERT INTO "constructorResults" VALUES ("3", "3", "30.0");
INSERT INTO "constructorResults" VALUES ("4", "4", "25.0");
INSERT INTO "constructorResults" VALUES ("5", "5", "18.0");
INSERT INTO "constructorResults" VALUES ("6", "6", "10.0");
INSERT INTO "constructorResults" VALUES ("7", "7", "5.0");
INSERT INTO "constructorResults" VALUES ("8", "4", "30.0");
INSERT INTO "constructorResults" VALUES ("9", "5", "20.0");
INSERT INTO "constructorResults" VALUES ("10", "7", "8.0");
INSERT INTO "constructorResults" VALUES ("11", "4", "60.0");
INSERT INTO "constructorResults" VALUES ("12", "5", "40.0");
INSERT INTO "constructorResults" VALUES ("13", "7", "15.0");
INSERT INTO "constructorResults" VALUES ("14", "1", "70.0");
INSERT INTO "constructorResults" VALUES ("15", "2", "65.0");
INSERT INTO "constructorStandings" VALUES ("1", "1", "1", "50.0", "1");
INSERT INTO "constructorStandings" VALUES ("2", "1", "2", "45.0", "0");
INSERT INTO "constructorStandings" VALUES ("3", "1", "4", "25.0", "0");
INSERT INTO "constructorStandings" VALUES ("4", "2", "1", "100.0", "2");
INSERT INTO "constructorStandings" VALUES ("5", "2", "2", "90.0", "1");
INSERT INTO "constructorStandings" VALUES ("6", "2", "4", "55.0", "0");
INSERT INTO "constructorStandings" VALUES ("7", "3", "1", "150.0", "3");
INSERT INTO "constructorStandings" VALUES ("8", "3", "2", "135.0", "2");
INSERT INTO "constructorStandings" VALUES ("9", "3", "4", "85.0", "0");
INSERT INTO "constructorStandings" VALUES ("10", "3", "5", "38.0", "0");
INSERT INTO "constructorStandings" VALUES ("11", "3", "7", "13.0", "0");
INSERT INTO "constructorStandings" VALUES ("12", "4", "4", "145.0", "1");
INSERT INTO "constructorStandings" VALUES ("13", "4", "5", "78.0", "0");
INSERT INTO "constructorStandings" VALUES ("14", "4", "7", "28.0", "0");