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,
"points" FLOAT,
"wins" INT,
PRIMARY KEY ("constructorStandingsId")
);

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

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



INSERT INTO "constructors" VALUES ("1", "British");
INSERT INTO "constructors" VALUES ("2", "German");
INSERT INTO "constructors" VALUES ("3", "Italian");
INSERT INTO "constructors" VALUES ("4", "French");
INSERT INTO "constructors" VALUES ("5", "Japanese");
INSERT INTO "races" VALUES ("23", "Grand Prix of Monaco");
INSERT INTO "races" VALUES ("24", "Grand Prix of Spain");
INSERT INTO "races" VALUES ("25", "Grand Prix of Canada");
INSERT INTO "races" VALUES ("26", "Grand Prix of Austria");
INSERT INTO "races" VALUES ("27", "Grand Prix of Great Britain");
INSERT INTO "constructorResults" VALUES ("1", "23", "1", "10.0");
INSERT INTO "constructorResults" VALUES ("2", "24", "2", "1.0");
INSERT INTO "constructorResults" VALUES ("3", "24", "3", "6.0");
INSERT INTO "constructorResults" VALUES ("4", "25", "1", "12.0");
INSERT INTO "constructorResults" VALUES ("5", "25", "4", "0.0");
INSERT INTO "constructorResults" VALUES ("6", "26", "2", "8.0");
INSERT INTO "constructorResults" VALUES ("7", "26", "5", "1.0");
INSERT INTO "constructorResults" VALUES ("8", "27", "3", "1.0");
INSERT INTO "constructorResults" VALUES ("9", "27", "1", "15.0");
INSERT INTO "constructorStandings" VALUES ("1", "22.0", "1");
INSERT INTO "constructorStandings" VALUES ("2", "9.0", "0");
INSERT INTO "constructorStandings" VALUES ("3", "7.0", "0");
INSERT INTO "constructorStandings" VALUES ("4", "0.0", "0");
INSERT INTO "constructorStandings" VALUES ("5", "1.0", "0");