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 "constructorStandings" (
"constructorStandingsId" INT,
"raceId" INT,
"constructorId" INT,
"position" INT,
"wins" INT,
PRIMARY KEY ("constructorStandingsId"),
FOREIGN KEY ("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("constructorId") REFERENCES "constructors"("constructorId")
);

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

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



INSERT INTO "constructors" VALUES ("1", "Mercedes", "German");
INSERT INTO "constructors" VALUES ("2", "Red Bull Racing", "Austrian");
INSERT INTO "constructors" VALUES ("3", "Ferrari", "Italian");
INSERT INTO "constructors" VALUES ("4", "McLaren", "British");
INSERT INTO "constructors" VALUES ("5", "Alpine", "French");
INSERT INTO "races" VALUES ("101");
INSERT INTO "races" VALUES ("102");
INSERT INTO "races" VALUES ("103");
INSERT INTO "races" VALUES ("104");
INSERT INTO "races" VALUES ("105");
INSERT INTO "constructorStandings" VALUES ("1001", "101", "1", "1", "3");
INSERT INTO "constructorStandings" VALUES ("1002", "101", "2", "2", "1");
INSERT INTO "constructorStandings" VALUES ("1003", "101", "3", "3", "0");
INSERT INTO "constructorStandings" VALUES ("1004", "102", "2", "1", "2");
INSERT INTO "constructorStandings" VALUES ("1005", "102", "1", "2", "1");
INSERT INTO "constructorStandings" VALUES ("1006", "102", "4", "3", "0");
INSERT INTO "constructorStandings" VALUES ("1007", "103", "3", "1", "1");
INSERT INTO "constructorStandings" VALUES ("1008", "103", "5", "2", "0");
INSERT INTO "constructorStandings" VALUES ("1009", "103", "1", "3", "0");
INSERT INTO "constructorStandings" VALUES ("1010", "104", "4", "1", "1");
INSERT INTO "constructorStandings" VALUES ("1011", "104", "2", "2", "0");
INSERT INTO "constructorStandings" VALUES ("1012", "104", "3", "3", "0");
INSERT INTO "constructorStandings" VALUES ("1013", "105", "5", "1", "2");
INSERT INTO "constructorStandings" VALUES ("1014", "105", "1", "2", "0");
INSERT INTO "constructorStandings" VALUES ("1015", "105", "2", "3", "0");
INSERT INTO "constructorResults" VALUES ("1001", "25.0");
INSERT INTO "constructorResults" VALUES ("1002", "18.0");
INSERT INTO "constructorResults" VALUES ("1003", "15.0");
INSERT INTO "constructorResults" VALUES ("1004", "25.0");
INSERT INTO "constructorResults" VALUES ("1005", "18.0");
INSERT INTO "constructorResults" VALUES ("1006", "15.0");
INSERT INTO "constructorResults" VALUES ("1007", "25.0");
INSERT INTO "constructorResults" VALUES ("1008", "18.0");
INSERT INTO "constructorResults" VALUES ("1009", "15.0");
INSERT INTO "constructorResults" VALUES ("1010", "25.0");
INSERT INTO "constructorResults" VALUES ("1011", "18.0");
INSERT INTO "constructorResults" VALUES ("1012", "15.0");
INSERT INTO "constructorResults" VALUES ("1013", "25.0");
INSERT INTO "constructorResults" VALUES ("1014", "18.0");
INSERT INTO "constructorResults" VALUES ("1015", "15.0");