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

CREATE TABLE "drivers" (
"driverId" INT UNIQUE,
"nationality" TEXT,
PRIMARY KEY ("driverId")
);

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

CREATE TABLE "results" (
"resultId" INT,
"raceId" INT,
"driverId" INT,
"position" INT,
"fastestLapSpeed" TEXT,
PRIMARY KEY ("resultId"),
FOREIGN KEY ("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
);



INSERT INTO "constructorResults" VALUES ("1", "10.0");
INSERT INTO "constructorResults" VALUES ("2", "15.0");
INSERT INTO "constructorResults" VALUES ("3", "25.0");
INSERT INTO "constructorResults" VALUES ("4", "0.0");
INSERT INTO "constructorResults" VALUES ("5", "18.0");
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", "Austrian");
INSERT INTO "drivers" VALUES ("1", "British");
INSERT INTO "drivers" VALUES ("2", "German");
INSERT INTO "drivers" VALUES ("3", "Spanish");
INSERT INTO "drivers" VALUES ("4", "Dutch");
INSERT INTO "drivers" VALUES ("5", "Finnish");
INSERT INTO "drivers" VALUES ("6", "French");
INSERT INTO "races" VALUES ("933");
INSERT INTO "races" VALUES ("934");
INSERT INTO "races" VALUES ("935");
INSERT INTO "races" VALUES ("936");
INSERT INTO "races" VALUES ("937");
INSERT INTO "results" VALUES ("1", "933", "1", "1", "220.500");
INSERT INTO "results" VALUES ("2", "933", "2", "2", "219.800");
INSERT INTO "results" VALUES ("3", "933", "3", "3", "221.100");
INSERT INTO "results" VALUES ("4", "933", "4", "4", "218.900");
INSERT INTO "results" VALUES ("5", "933", "5", "5", "220.000");
INSERT INTO "results" VALUES ("6", "934", "1", "1", "225.000");
INSERT INTO "results" VALUES ("7", "934", "2", "2", "224.500");
INSERT INTO "results" VALUES ("8", "935", "3", "1", "230.000");
INSERT INTO "results" VALUES ("9", "936", "4", "1", "228.000");
INSERT INTO "results" VALUES ("10", "937", "5", "1", "227.500");
INSERT INTO "results" VALUES ("11", "933", "6", "6", "217.000");