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

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

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

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



INSERT INTO "constructors" VALUES ("1", "Italian", "http://ferrari.com");
INSERT INTO "constructors" VALUES ("2", "British", "http://mercedes.com");
INSERT INTO "constructors" VALUES ("3", "Italian", "http://alfaromeo.com");
INSERT INTO "constructors" VALUES ("4", "German", "http://audi.com");
INSERT INTO "races" VALUES ("1", "2018");
INSERT INTO "races" VALUES ("2", "2019");
INSERT INTO "races" VALUES ("3", "2020");
INSERT INTO "races" VALUES ("4", "2021");
INSERT INTO "races" VALUES ("5", "2022");
INSERT INTO "constructorStandings" VALUES ("1", "1", "1", "150.5");
INSERT INTO "constructorStandings" VALUES ("2", "2", "1", "180.0");
INSERT INTO "constructorStandings" VALUES ("3", "3", "1", "170.0");
INSERT INTO "constructorStandings" VALUES ("4", "4", "1", "200.0");
INSERT INTO "constructorStandings" VALUES ("5", "5", "1", "190.0");
INSERT INTO "constructorStandings" VALUES ("6", "1", "2", "160.0");
INSERT INTO "constructorStandings" VALUES ("7", "2", "2", "170.0");
INSERT INTO "constructorStandings" VALUES ("8", "3", "2", "180.0");
INSERT INTO "constructorStandings" VALUES ("9", "4", "2", "210.0");
INSERT INTO "constructorStandings" VALUES ("10", "5", "2", "220.0");
INSERT INTO "constructorStandings" VALUES ("11", "1", "3", "140.0");
INSERT INTO "constructorStandings" VALUES ("12", "2", "3", "160.0");
INSERT INTO "constructorStandings" VALUES ("13", "3", "3", "165.0");
INSERT INTO "constructorStandings" VALUES ("14", "4", "3", "195.0");
INSERT INTO "constructorStandings" VALUES ("15", "5", "3", "205.0");
INSERT INTO "constructorStandings" VALUES ("16", "1", "4", "130.0");
INSERT INTO "constructorStandings" VALUES ("17", "2", "4", "140.0");
INSERT INTO "constructorStandings" VALUES ("18", "3", "4", "150.0");
INSERT INTO "constructorStandings" VALUES ("19", "4", "4", "160.0");
INSERT INTO "constructorStandings" VALUES ("20", "5", "4", "170.0");
INSERT INTO "constructorResults" VALUES ("1", "895.5");
INSERT INTO "constructorResults" VALUES ("2", "930.0");
INSERT INTO "constructorResults" VALUES ("3", "865.0");
INSERT INTO "constructorResults" VALUES ("4", "750.0");
INSERT INTO "results" VALUES ("1", "25.0");
INSERT INTO "results" VALUES ("2", "18.0");
INSERT INTO "results" VALUES ("3", "15.0");
INSERT INTO "results" VALUES ("4", "12.0");