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

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

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

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



INSERT INTO "driverStandings" VALUES ("1", "45.0");
INSERT INTO "driverStandings" VALUES ("2", "30.0");
INSERT INTO "driverStandings" VALUES ("3", "60.0");
INSERT INTO "driverStandings" VALUES ("4", "0.0");
INSERT INTO "drivers" VALUES ("1", "Eddie", "Irvine");
INSERT INTO "drivers" VALUES ("2", "Michael", "Schumacher");
INSERT INTO "drivers" VALUES ("3", "Rubens", "Barrichello");
INSERT INTO "drivers" VALUES ("4", "David", "Coulthard");
INSERT INTO "races" VALUES ("1", "2000", "1");
INSERT INTO "races" VALUES ("2", "2000", "2");
INSERT INTO "races" VALUES ("3", "2000", "3");
INSERT INTO "races" VALUES ("4", "1999", "1");
INSERT INTO "races" VALUES ("5", "2001", "1");
INSERT INTO "results" VALUES ("1", "1", "1", "3", "6.0");
INSERT INTO "results" VALUES ("2", "2", "1", "2", "8.0");
INSERT INTO "results" VALUES ("3", "3", "1", "5", "4.0");
INSERT INTO "results" VALUES ("4", "1", "2", "1", "10.0");
INSERT INTO "results" VALUES ("5", "2", "2", "1", "10.0");
INSERT INTO "results" VALUES ("6", "3", "2", "2", "8.0");
INSERT INTO "results" VALUES ("7", "4", "1", "1", "10.0");
INSERT INTO "results" VALUES ("8", "5", "1", "4", "5.0");
INSERT INTO "results" VALUES ("9", "1", "3", "4", "5.0");
INSERT INTO "results" VALUES ("10", "2", "3", "3", "6.0");
INSERT INTO "results" VALUES ("11", "3", "3", "1", "10.0");
INSERT INTO "results" VALUES ("12", "1", "4", "6", "3.0");
INSERT INTO "results" VALUES ("13", "2", "4", "7", "2.0");
INSERT INTO "results" VALUES ("14", "3", "4", "8", "1.0");