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

CREATE TABLE "driverStandings" (
"driverStandingsId" INT,
"points" FLOAT,
PRIMARY KEY ("driverStandingsId")
);

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

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

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



INSERT INTO "constructors" VALUES ("1", "Scuderia Ferrari", "Italian");
INSERT INTO "constructors" VALUES ("2", "McLaren", "British");
INSERT INTO "constructors" VALUES ("3", "Williams", "British");
INSERT INTO "constructors" VALUES ("4", "Lotus", "British");
INSERT INTO "constructors" VALUES ("5", "Renault", "French");
INSERT INTO "races" VALUES ("101", "1979", "Monaco Grand Prix");
INSERT INTO "races" VALUES ("102", "1980", "Monaco Grand Prix");
INSERT INTO "races" VALUES ("103", "1985", "Monaco Grand Prix");
INSERT INTO "races" VALUES ("104", "1990", "Monaco Grand Prix");
INSERT INTO "races" VALUES ("105", "1995", "Monaco Grand Prix");
INSERT INTO "races" VALUES ("106", "2000", "Monaco Grand Prix");
INSERT INTO "races" VALUES ("107", "2005", "Monaco Grand Prix");
INSERT INTO "races" VALUES ("108", "2010", "Monaco Grand Prix");
INSERT INTO "races" VALUES ("109", "2011", "Monaco Grand Prix");
INSERT INTO "races" VALUES ("110", "2005", "British Grand Prix");
INSERT INTO "constructorResults" VALUES ("1001", "102", "1", "10.0");
INSERT INTO "constructorResults" VALUES ("1002", "102", "2", "8.0");
INSERT INTO "constructorResults" VALUES ("1003", "103", "1", "12.0");
INSERT INTO "constructorResults" VALUES ("1004", "103", "3", "15.0");
INSERT INTO "constructorResults" VALUES ("1005", "104", "2", "18.0");
INSERT INTO "constructorResults" VALUES ("1006", "104", "1", "14.0");
INSERT INTO "constructorResults" VALUES ("1007", "105", "4", "20.0");
INSERT INTO "constructorResults" VALUES ("1008", "105", "1", "5.0");
INSERT INTO "constructorResults" VALUES ("1009", "106", "1", "25.0");
INSERT INTO "constructorResults" VALUES ("1010", "106", "5", "10.0");
INSERT INTO "constructorResults" VALUES ("1011", "107", "3", "22.0");
INSERT INTO "constructorResults" VALUES ("1012", "107", "1", "18.0");
INSERT INTO "constructorResults" VALUES ("1013", "108", "1", "30.0");
INSERT INTO "constructorResults" VALUES ("1014", "108", "2", "12.0");
INSERT INTO "constructorResults" VALUES ("1015", "109", "1", "28.0");
INSERT INTO "constructorResults" VALUES ("1016", "110", "1", "15.0");
INSERT INTO "constructorStandings" VALUES ("1", "5");
INSERT INTO "constructorStandings" VALUES ("2", "3");
INSERT INTO "constructorStandings" VALUES ("3", "4");
INSERT INTO "constructorStandings" VALUES ("4", "2");
INSERT INTO "constructorStandings" VALUES ("5", "1");
INSERT INTO "driverStandings" VALUES ("1", "150.0");
INSERT INTO "driverStandings" VALUES ("2", "120.0");
INSERT INTO "driverStandings" VALUES ("3", "130.0");
INSERT INTO "driverStandings" VALUES ("4", "110.0");
INSERT INTO "driverStandings" VALUES ("5", "90.0");
INSERT INTO "results" VALUES ("1", "1");
INSERT INTO "results" VALUES ("2", "2");
INSERT INTO "results" VALUES ("3", "3");
INSERT INTO "results" VALUES ("4", "4");
INSERT INTO "results" VALUES ("5", "5");