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

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,
"name" TEXT,
PRIMARY KEY ("constructorId")
);

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

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

CREATE TABLE "status" (
"statusId" INT,
"status" TEXT,
PRIMARY KEY ("statusId")
);



INSERT INTO "constructors" VALUES ("1", "Red Bull Racing");
INSERT INTO "constructors" VALUES ("2", "Mercedes");
INSERT INTO "constructors" VALUES ("3", "Ferrari");
INSERT INTO "constructors" VALUES ("4", "McLaren");
INSERT INTO "races" VALUES ("101", "2022");
INSERT INTO "races" VALUES ("102", "2022");
INSERT INTO "races" VALUES ("103", "2023");
INSERT INTO "races" VALUES ("104", "2023");
INSERT INTO "constructorResults" VALUES ("1001", "101", "1", "25.0");
INSERT INTO "constructorResults" VALUES ("1002", "101", "2", "18.0");
INSERT INTO "constructorResults" VALUES ("1003", "101", "3", "15.0");
INSERT INTO "constructorResults" VALUES ("1004", "101", "4", "12.0");
INSERT INTO "constructorResults" VALUES ("1005", "102", "1", "18.0");
INSERT INTO "constructorResults" VALUES ("1006", "102", "2", "25.0");
INSERT INTO "constructorResults" VALUES ("1007", "102", "3", "10.0");
INSERT INTO "constructorResults" VALUES ("1008", "102", "4", "8.0");
INSERT INTO "constructorResults" VALUES ("1009", "103", "1", "30.0");
INSERT INTO "constructorResults" VALUES ("1010", "103", "2", "20.0");
INSERT INTO "constructorResults" VALUES ("1011", "103", "3", "12.0");
INSERT INTO "constructorResults" VALUES ("1012", "103", "4", "5.0");
INSERT INTO "constructorResults" VALUES ("1013", "104", "1", "22.0");
INSERT INTO "constructorResults" VALUES ("1014", "104", "2", "28.0");
INSERT INTO "constructorResults" VALUES ("1015", "104", "3", "14.0");
INSERT INTO "constructorResults" VALUES ("1016", "104", "4", "7.0");
INSERT INTO "constructorStandings" VALUES ("2001", "101", "1", "25.0");
INSERT INTO "constructorStandings" VALUES ("2002", "101", "2", "18.0");
INSERT INTO "constructorStandings" VALUES ("2003", "101", "3", "15.0");
INSERT INTO "constructorStandings" VALUES ("2004", "101", "4", "12.0");
INSERT INTO "constructorStandings" VALUES ("2005", "102", "1", "43.0");
INSERT INTO "constructorStandings" VALUES ("2006", "102", "2", "43.0");
INSERT INTO "constructorStandings" VALUES ("2007", "102", "3", "25.0");
INSERT INTO "constructorStandings" VALUES ("2008", "102", "4", "20.0");
INSERT INTO "constructorStandings" VALUES ("2009", "103", "1", "73.0");
INSERT INTO "constructorStandings" VALUES ("2010", "103", "2", "63.0");
INSERT INTO "constructorStandings" VALUES ("2011", "103", "3", "37.0");
INSERT INTO "constructorStandings" VALUES ("2012", "103", "4", "25.0");
INSERT INTO "constructorStandings" VALUES ("2013", "104", "1", "95.0");
INSERT INTO "constructorStandings" VALUES ("2014", "104", "2", "91.0");
INSERT INTO "constructorStandings" VALUES ("2015", "104", "3", "51.0");
INSERT INTO "constructorStandings" VALUES ("2016", "104", "4", "32.0");
INSERT INTO "results" VALUES ("3001", "25.0");
INSERT INTO "results" VALUES ("3002", "18.0");
INSERT INTO "results" VALUES ("3003", "15.0");
INSERT INTO "results" VALUES ("3004", "12.0");
INSERT INTO "results" VALUES ("3005", "30.0");
INSERT INTO "results" VALUES ("3006", "20.0");
INSERT INTO "results" VALUES ("3007", "22.0");
INSERT INTO "results" VALUES ("3008", "28.0");
INSERT INTO "status" VALUES ("4001", "Finished");
INSERT INTO "status" VALUES ("4002", "Retired");
INSERT INTO "status" VALUES ("4003", "Disqualified");
INSERT INTO "status" VALUES ("4004", "Accident");