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

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

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

CREATE TABLE "qualifying" (
"qualifyId" INT,
"position" INT,
PRIMARY KEY ("qualifyId")
);

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

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



INSERT INTO "driverStandings" VALUES ("1", "1");
INSERT INTO "driverStandings" VALUES ("2", "2");
INSERT INTO "driverStandings" VALUES ("3", "3");
INSERT INTO "driverStandings" VALUES ("4", "4");
INSERT INTO "driverStandings" VALUES ("5", "5");
INSERT INTO "driverStandings" VALUES ("6", "6");
INSERT INTO "driverStandings" VALUES ("7", "7");
INSERT INTO "driverStandings" VALUES ("8", "8");
INSERT INTO "driverStandings" VALUES ("9", "9");
INSERT INTO "driverStandings" VALUES ("10", "10");
INSERT INTO "constructors" VALUES ("1", "McLaren");
INSERT INTO "constructors" VALUES ("2", "Ferrari");
INSERT INTO "constructors" VALUES ("3", "Mercedes");
INSERT INTO "constructors" VALUES ("4", "Red Bull");
INSERT INTO "constructors" VALUES ("5", "Williams");
INSERT INTO "constructors" VALUES ("6", "Renault");
INSERT INTO "constructors" VALUES ("7", "Sauber");
INSERT INTO "constructors" VALUES ("8", "Force India");
INSERT INTO "constructors" VALUES ("9", "Toro Rosso");
INSERT INTO "constructors" VALUES ("10", "Haas");
INSERT INTO "drivers" VALUES ("1", "Lewis", "Hamilton");
INSERT INTO "drivers" VALUES ("2", "Sebastian", "Vettel");
INSERT INTO "drivers" VALUES ("3", "Fernando", "Alonso");
INSERT INTO "drivers" VALUES ("4", "Kimi", "Raikkonen");
INSERT INTO "drivers" VALUES ("5", "Max", "Verstappen");
INSERT INTO "drivers" VALUES ("6", "Daniel", "Ricciardo");
INSERT INTO "drivers" VALUES ("7", "Valtteri", "Bottas");
INSERT INTO "drivers" VALUES ("8", "Sergio", "Perez");
INSERT INTO "drivers" VALUES ("9", "Nico", "Rosberg");
INSERT INTO "drivers" VALUES ("10", "Jenson", "Button");
INSERT INTO "qualifying" VALUES ("1", "1");
INSERT INTO "qualifying" VALUES ("2", "2");
INSERT INTO "qualifying" VALUES ("3", "3");
INSERT INTO "qualifying" VALUES ("4", "4");
INSERT INTO "qualifying" VALUES ("5", "5");
INSERT INTO "qualifying" VALUES ("6", "6");
INSERT INTO "qualifying" VALUES ("7", "7");
INSERT INTO "qualifying" VALUES ("8", "8");
INSERT INTO "qualifying" VALUES ("9", "9");
INSERT INTO "qualifying" VALUES ("10", "10");
INSERT INTO "races" VALUES ("1", "2007", "Australian Grand Prix");
INSERT INTO "races" VALUES ("2", "2007", "Malaysian Grand Prix");
INSERT INTO "races" VALUES ("3", "2007", "Bahrain Grand Prix");
INSERT INTO "races" VALUES ("4", "2008", "Australian Grand Prix");
INSERT INTO "races" VALUES ("5", "2008", "Malaysian Grand Prix");
INSERT INTO "races" VALUES ("6", "2009", "Australian Grand Prix");
INSERT INTO "races" VALUES ("7", "2010", "Bahrain Grand Prix");
INSERT INTO "races" VALUES ("8", "2011", "Australian Grand Prix");
INSERT INTO "races" VALUES ("9", "2012", "Malaysian Grand Prix");
INSERT INTO "races" VALUES ("10", "2013", "Bahrain Grand Prix");
INSERT INTO "results" VALUES ("1", "1", "1", "6.0");
INSERT INTO "results" VALUES ("2", "2", "1", "8.0");
INSERT INTO "results" VALUES ("3", "3", "1", "10.0");
INSERT INTO "results" VALUES ("4", "4", "2", "10.0");
INSERT INTO "results" VALUES ("5", "5", "3", "8.0");
INSERT INTO "results" VALUES ("6", "6", "4", "6.0");
INSERT INTO "results" VALUES ("7", "7", "5", "4.0");
INSERT INTO "results" VALUES ("8", "8", "6", "2.0");
INSERT INTO "results" VALUES ("9", "9", "7", "1.0");
INSERT INTO "results" VALUES ("10", "10", "1", "0.0");
INSERT INTO "results" VALUES ("11", "1", "2", "4.0");
INSERT INTO "results" VALUES ("12", "1", "3", "2.0");
INSERT INTO "results" VALUES ("13", "1", "4", "1.0");
INSERT INTO "results" VALUES ("14", "2", "2", "6.0");
INSERT INTO "results" VALUES ("15", "3", "2", "8.0");