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

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

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

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



INSERT INTO "driverStandings" VALUES ("1", "10.0", "1", "1");
INSERT INTO "driverStandings" VALUES ("2", "8.0", "2", "0");
INSERT INTO "driverStandings" VALUES ("3", "6.0", "3", "0");
INSERT INTO "driverStandings" VALUES ("4", "5.0", "4", "0");
INSERT INTO "driverStandings" VALUES ("5", "4.0", "5", "0");
INSERT INTO "driverStandings" VALUES ("6", "3.0", "6", "0");
INSERT INTO "driverStandings" VALUES ("7", "2.0", "7", "0");
INSERT INTO "driverStandings" VALUES ("8", "1.0", "8", "0");
INSERT INTO "driverStandings" VALUES ("9", "0.0", "9", "0");
INSERT INTO "driverStandings" VALUES ("10", "0.0", "10", "0");
INSERT INTO "drivers" VALUES ("1", "Fernando", "Alonso");
INSERT INTO "drivers" VALUES ("2", "Michael", "Schumacher");
INSERT INTO "drivers" VALUES ("3", "Kimi", "Raikkonen");
INSERT INTO "drivers" VALUES ("4", "Jenson", "Button");
INSERT INTO "drivers" VALUES ("5", "Felipe", "Massa");
INSERT INTO "drivers" VALUES ("6", "Giancarlo", "Fisichella");
INSERT INTO "drivers" VALUES ("7", "Rubens", "Barrichello");
INSERT INTO "drivers" VALUES ("8", "Juan Pablo", "Montoya");
INSERT INTO "drivers" VALUES ("9", "Mark", "Webber");
INSERT INTO "drivers" VALUES ("10", "Nick", "Heidfeld");
INSERT INTO "races" VALUES ("1", "2006", "Bahrain Grand Prix");
INSERT INTO "races" VALUES ("2", "2006", "Malaysian Grand Prix");
INSERT INTO "races" VALUES ("3", "2006", "Australian Grand Prix");
INSERT INTO "races" VALUES ("4", "2006", "San Marino Grand Prix");
INSERT INTO "races" VALUES ("5", "2006", "European Grand Prix");
INSERT INTO "races" VALUES ("6", "2005", "San Marino Grand Prix");
INSERT INTO "races" VALUES ("7", "2007", "San Marino Grand Prix");
INSERT INTO "races" VALUES ("8", "2006", "Monaco Grand Prix");
INSERT INTO "results" VALUES ("1", "4", "2", "1", "1");
INSERT INTO "results" VALUES ("2", "4", "1", "2", "2");
INSERT INTO "results" VALUES ("3", "4", "5", "3", "3");
INSERT INTO "results" VALUES ("4", "4", "4", "4", "4");
INSERT INTO "results" VALUES ("5", "4", "3", "5", "5");
INSERT INTO "results" VALUES ("6", "4", "6", "6", "6");
INSERT INTO "results" VALUES ("7", "4", "7", "7", "7");
INSERT INTO "results" VALUES ("8", "4", "8", "8", "8");
INSERT INTO "results" VALUES ("9", "4", "9", "9", "9");
INSERT INTO "results" VALUES ("10", "4", "10", "10", "10");
INSERT INTO "results" VALUES ("11", "6", "1", "1", "1");
INSERT INTO "results" VALUES ("12", "6", "2", "2", "2");
INSERT INTO "results" VALUES ("13", "7", "3", "1", "1");
INSERT INTO "results" VALUES ("14", "7", "1", "2", "2");
INSERT INTO "results" VALUES ("15", "1", "1", "1", "1");
INSERT INTO "results" VALUES ("16", "1", "2", "2", "2");
INSERT INTO "results" VALUES ("17", "2", "1", "1", "1");
INSERT INTO "results" VALUES ("18", "2", "2", "3", "3");
INSERT INTO "results" VALUES ("19", "3", "4", "1", "1");
INSERT INTO "results" VALUES ("20", "3", "1", "2", "2");