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

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

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

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

CREATE TABLE "results" (
"resultId" INT,
"raceId" INT,
"constructorId" INT,
"laps" INT,
PRIMARY KEY ("resultId"),
FOREIGN KEY ("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("constructorId") REFERENCES "constructors"("constructorId")
);



INSERT INTO "constructorStandings" VALUES ("1", "100.0");
INSERT INTO "constructorStandings" VALUES ("2", "80.0");
INSERT INTO "constructorStandings" VALUES ("3", "60.0");
INSERT INTO "constructorStandings" VALUES ("4", "40.0");
INSERT INTO "constructorStandings" VALUES ("5", "20.0");
INSERT INTO "constructors" VALUES ("1", "French");
INSERT INTO "constructors" VALUES ("2", "British");
INSERT INTO "constructors" VALUES ("3", "French");
INSERT INTO "constructors" VALUES ("4", "German");
INSERT INTO "constructors" VALUES ("5", "French");
INSERT INTO "constructors" VALUES ("6", "Italian");
INSERT INTO "drivers" VALUES ("1", "French");
INSERT INTO "drivers" VALUES ("2", "British");
INSERT INTO "drivers" VALUES ("3", "German");
INSERT INTO "drivers" VALUES ("4", "Spanish");
INSERT INTO "drivers" VALUES ("5", "French");
INSERT INTO "races" VALUES ("1", "Grand Prix 1");
INSERT INTO "races" VALUES ("2", "Grand Prix 2");
INSERT INTO "races" VALUES ("3", "Grand Prix 3");
INSERT INTO "races" VALUES ("4", "Grand Prix 4");
INSERT INTO "races" VALUES ("5", "Grand Prix 5");
INSERT INTO "results" VALUES ("1", "1", "1", "55");
INSERT INTO "results" VALUES ("2", "1", "2", "45");
INSERT INTO "results" VALUES ("3", "2", "3", "60");
INSERT INTO "results" VALUES ("4", "2", "4", "50");
INSERT INTO "results" VALUES ("5", "3", "1", "48");
INSERT INTO "results" VALUES ("6", "3", "5", "52");
INSERT INTO "results" VALUES ("7", "4", "2", "58");
INSERT INTO "results" VALUES ("8", "4", "3", "40");
INSERT INTO "results" VALUES ("9", "5", "5", "65");
INSERT INTO "results" VALUES ("10", "5", "6", "51");