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,
"raceId" 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")
);

CREATE TABLE "results" (
"resultId" INT,
"position" INT,
PRIMARY KEY ("resultId")
);



INSERT INTO "constructors" VALUES ("1", "Mercedes", "German");
INSERT INTO "constructors" VALUES ("2", "Red Bull", "Austrian");
INSERT INTO "constructors" VALUES ("3", "McLaren", "British");
INSERT INTO "constructors" VALUES ("4", "Williams", "British");
INSERT INTO "constructors" VALUES ("5", "Ferrari", "Italian");
INSERT INTO "constructors" VALUES ("6", "Aston Martin", "British");
INSERT INTO "constructorResults" VALUES ("1", "101", "3", "15.0");
INSERT INTO "constructorResults" VALUES ("2", "101", "4", "10.0");
INSERT INTO "constructorResults" VALUES ("3", "101", "6", "8.0");
INSERT INTO "constructorResults" VALUES ("4", "102", "3", "18.0");
INSERT INTO "constructorResults" VALUES ("5", "102", "4", "12.0");
INSERT INTO "constructorResults" VALUES ("6", "102", "6", "20.0");
INSERT INTO "constructorResults" VALUES ("7", "103", "3", "25.0");
INSERT INTO "constructorResults" VALUES ("8", "103", "4", "0.0");
INSERT INTO "constructorResults" VALUES ("9", "103", "6", "5.0");
INSERT INTO "constructorResults" VALUES ("10", "104", "1", "30.0");
INSERT INTO "constructorResults" VALUES ("11", "104", "2", "28.0");
INSERT INTO "constructorResults" VALUES ("12", "104", "5", "22.0");
INSERT INTO "constructorStandings" VALUES ("1", "101", "3", "15.0", "1");
INSERT INTO "constructorStandings" VALUES ("2", "101", "4", "10.0", "0");
INSERT INTO "constructorStandings" VALUES ("3", "101", "6", "8.0", "0");
INSERT INTO "constructorStandings" VALUES ("4", "102", "3", "18.0", "1");
INSERT INTO "constructorStandings" VALUES ("5", "102", "4", "12.0", "0");
INSERT INTO "constructorStandings" VALUES ("6", "102", "6", "20.0", "2");
INSERT INTO "constructorStandings" VALUES ("7", "103", "3", "25.0", "3");
INSERT INTO "constructorStandings" VALUES ("8", "103", "4", "0.0", "0");
INSERT INTO "constructorStandings" VALUES ("9", "103", "6", "5.0", "0");
INSERT INTO "constructorStandings" VALUES ("10", "104", "1", "30.0", "4");
INSERT INTO "constructorStandings" VALUES ("11", "104", "2", "28.0", "3");
INSERT INTO "constructorStandings" VALUES ("12", "104", "5", "22.0", "1");
INSERT INTO "results" VALUES ("1", "1");
INSERT INTO "results" VALUES ("2", "2");
INSERT INTO "results" VALUES ("3", "3");
INSERT INTO "results" VALUES ("4", "4");
INSERT INTO "results" VALUES ("5", "5");