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,
"constructorId" INT,
PRIMARY KEY ("constructorResultsId"),
FOREIGN KEY ("constructorId") REFERENCES "constructors"("constructorId")
);

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,
"position" INT,
PRIMARY KEY ("resultId"),
FOREIGN KEY ("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
);



INSERT INTO "constructorResults" VALUES ("1", "1");
INSERT INTO "constructorResults" VALUES ("2", "2");
INSERT INTO "constructorResults" VALUES ("3", "3");
INSERT INTO "constructorResults" VALUES ("4", "4");
INSERT INTO "constructorResults" VALUES ("5", "5");
INSERT INTO "constructorResults" VALUES ("6", "6");
INSERT INTO "constructorResults" VALUES ("7", "7");
INSERT INTO "constructorResults" VALUES ("8", "8");
INSERT INTO "constructorResults" VALUES ("9", "9");
INSERT INTO "constructorResults" VALUES ("10", "10");
INSERT INTO "constructors" VALUES ("1", "Red Bull");
INSERT INTO "constructors" VALUES ("2", "McLaren");
INSERT INTO "constructors" VALUES ("3", "Ferrari");
INSERT INTO "constructors" VALUES ("4", "Mercedes");
INSERT INTO "constructors" VALUES ("5", "Renault");
INSERT INTO "constructors" VALUES ("6", "Williams");
INSERT INTO "constructors" VALUES ("7", "Force India");
INSERT INTO "constructors" VALUES ("8", "Sauber");
INSERT INTO "constructors" VALUES ("9", "Toro Rosso");
INSERT INTO "constructors" VALUES ("10", "Lotus");
INSERT INTO "drivers" VALUES ("1", "Sebastian", "Vettel");
INSERT INTO "drivers" VALUES ("2", "Lewis", "Hamilton");
INSERT INTO "drivers" VALUES ("3", "Fernando", "Alonso");
INSERT INTO "drivers" VALUES ("4", "Mark", "Webber");
INSERT INTO "drivers" VALUES ("5", "Jenson", "Button");
INSERT INTO "drivers" VALUES ("6", "Felipe", "Massa");
INSERT INTO "drivers" VALUES ("7", "Nico", "Rosberg");
INSERT INTO "drivers" VALUES ("8", "Robert", "Kubica");
INSERT INTO "drivers" VALUES ("9", "Michael", "Schumacher");
INSERT INTO "drivers" VALUES ("10", "Rubens", "Barrichello");
INSERT INTO "drivers" VALUES ("11", "Adrian", "Sutil");
INSERT INTO "drivers" VALUES ("12", "Kamui", "Kobayashi");
INSERT INTO "drivers" VALUES ("13", "Vitaly", "Petrov");
INSERT INTO "drivers" VALUES ("14", "Jaime", "Alguersuari");
INSERT INTO "drivers" VALUES ("15", "Heikki", "Kovalainen");
INSERT INTO "drivers" VALUES ("16", "Bruno", "Senna");
INSERT INTO "drivers" VALUES ("17", "Lucas", "di Grassi");
INSERT INTO "drivers" VALUES ("18", "Timo", "Glock");
INSERT INTO "drivers" VALUES ("19", "Christian", "Klien");
INSERT INTO "drivers" VALUES ("20", "Sakon", "Yamamoto");
INSERT INTO "drivers" VALUES ("21", "Nick", "Heidfeld");
INSERT INTO "drivers" VALUES ("22", "Paul", "di Resta");
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 "qualifying" VALUES ("11", "11");
INSERT INTO "qualifying" VALUES ("12", "12");
INSERT INTO "qualifying" VALUES ("13", "13");
INSERT INTO "qualifying" VALUES ("14", "14");
INSERT INTO "qualifying" VALUES ("15", "15");
INSERT INTO "qualifying" VALUES ("16", "16");
INSERT INTO "qualifying" VALUES ("17", "17");
INSERT INTO "qualifying" VALUES ("18", "18");
INSERT INTO "qualifying" VALUES ("19", "19");
INSERT INTO "qualifying" VALUES ("20", "20");
INSERT INTO "qualifying" VALUES ("21", "21");
INSERT INTO "qualifying" VALUES ("22", "22");
INSERT INTO "qualifying" VALUES ("23", "23");
INSERT INTO "qualifying" VALUES ("24", "24");
INSERT INTO "races" VALUES ("1", "2010", "Bahrain Grand Prix");
INSERT INTO "races" VALUES ("2", "2010", "Australian Grand Prix");
INSERT INTO "races" VALUES ("3", "2010", "Malaysian Grand Prix");
INSERT INTO "races" VALUES ("4", "2010", "Chinese Grand Prix");
INSERT INTO "races" VALUES ("5", "2010", "Spanish Grand Prix");
INSERT INTO "races" VALUES ("6", "2010", "Monaco Grand Prix");
INSERT INTO "races" VALUES ("7", "2010", "Turkish Grand Prix");
INSERT INTO "races" VALUES ("8", "2010", "Canadian Grand Prix");
INSERT INTO "races" VALUES ("9", "2010", "European Grand Prix");
INSERT INTO "races" VALUES ("10", "2010", "British Grand Prix");
INSERT INTO "races" VALUES ("11", "2010", "German Grand Prix");
INSERT INTO "races" VALUES ("12", "2010", "Hungarian Grand Prix");
INSERT INTO "races" VALUES ("13", "2010", "Belgian Grand Prix");
INSERT INTO "races" VALUES ("14", "2010", "Italian Grand Prix");
INSERT INTO "races" VALUES ("15", "2010", "Singapore Grand Prix");
INSERT INTO "races" VALUES ("16", "2010", "Japanese Grand Prix");
INSERT INTO "races" VALUES ("17", "2010", "Korean Grand Prix");
INSERT INTO "races" VALUES ("18", "2010", "Brazilian Grand Prix");
INSERT INTO "races" VALUES ("19", "2010", "Abu Dhabi Grand Prix");
INSERT INTO "races" VALUES ("20", "2011", "Australian Grand Prix");
INSERT INTO "races" VALUES ("21", "2011", "Malaysian Grand Prix");
INSERT INTO "races" VALUES ("22", "2011", "Chinese Grand Prix");
INSERT INTO "races" VALUES ("23", "2011", "Turkish Grand Prix");
INSERT INTO "races" VALUES ("24", "2011", "Spanish Grand Prix");
INSERT INTO "races" VALUES ("25", "2011", "Monaco Grand Prix");
INSERT INTO "races" VALUES ("26", "2011", "Canadian Grand Prix");
INSERT INTO "races" VALUES ("27", "2011", "European Grand Prix");
INSERT INTO "races" VALUES ("28", "2011", "British Grand Prix");
INSERT INTO "races" VALUES ("29", "2011", "German Grand Prix");
INSERT INTO "races" VALUES ("30", "2011", "Hungarian Grand Prix");
INSERT INTO "races" VALUES ("31", "2011", "Belgian Grand Prix");
INSERT INTO "races" VALUES ("32", "2011", "Italian Grand Prix");
INSERT INTO "races" VALUES ("33", "2011", "Singapore Grand Prix");
INSERT INTO "races" VALUES ("34", "2011", "Japanese Grand Prix");
INSERT INTO "races" VALUES ("35", "2011", "Korean Grand Prix");
INSERT INTO "races" VALUES ("36", "2011", "Indian Grand Prix");
INSERT INTO "races" VALUES ("37", "2011", "Abu Dhabi Grand Prix");
INSERT INTO "races" VALUES ("38", "2011", "Brazilian Grand Prix");
INSERT INTO "results" VALUES ("1", "15", "3", "1");
INSERT INTO "results" VALUES ("2", "15", "1", "2");
INSERT INTO "results" VALUES ("3", "15", "4", "3");
INSERT INTO "results" VALUES ("4", "15", "5", "4");
INSERT INTO "results" VALUES ("5", "15", "7", "5");
INSERT INTO "results" VALUES ("6", "15", "8", "6");
INSERT INTO "results" VALUES ("7", "15", "6", "7");
INSERT INTO "results" VALUES ("8", "15", "10", "8");
INSERT INTO "results" VALUES ("9", "15", "11", "9");
INSERT INTO "results" VALUES ("10", "15", "12", "10");
INSERT INTO "results" VALUES ("11", "15", "13", "11");
INSERT INTO "results" VALUES ("12", "15", "14", "12");
INSERT INTO "results" VALUES ("13", "15", "15", "13");
INSERT INTO "results" VALUES ("14", "15", "16", "14");
INSERT INTO "results" VALUES ("15", "15", "17", "15");
INSERT INTO "results" VALUES ("16", "15", "18", "16");
INSERT INTO "results" VALUES ("17", "15", "19", "17");
INSERT INTO "results" VALUES ("18", "15", "20", "18");
INSERT INTO "results" VALUES ("19", "15", "2", "19");
INSERT INTO "results" VALUES ("20", "1", "3", "1");
INSERT INTO "results" VALUES ("21", "1", "6", "2");
INSERT INTO "results" VALUES ("22", "1", "1", "3");
INSERT INTO "results" VALUES ("23", "1", "4", "4");
INSERT INTO "results" VALUES ("24", "1", "7", "5");
INSERT INTO "results" VALUES ("25", "1", "5", "6");
INSERT INTO "results" VALUES ("26", "1", "9", "7");
INSERT INTO "results" VALUES ("27", "1", "10", "8");
INSERT INTO "results" VALUES ("28", "1", "11", "9");
INSERT INTO "results" VALUES ("29", "1", "12", "10");
INSERT INTO "results" VALUES ("30", "1", "13", "11");
INSERT INTO "results" VALUES ("31", "1", "14", "12");
INSERT INTO "results" VALUES ("32", "1", "15", "13");
INSERT INTO "results" VALUES ("33", "1", "16", "14");
INSERT INTO "results" VALUES ("34", "1", "17", "15");
INSERT INTO "results" VALUES ("35", "1", "18", "16");
INSERT INTO "results" VALUES ("36", "1", "19", "17");
INSERT INTO "results" VALUES ("37", "1", "20", "18");
INSERT INTO "results" VALUES ("38", "1", "2", "19");
INSERT INTO "results" VALUES ("39", "33", "1", "1");
INSERT INTO "results" VALUES ("40", "33", "5", "2");
INSERT INTO "results" VALUES ("41", "33", "4", "3");
INSERT INTO "results" VALUES ("42", "33", "2", "4");
INSERT INTO "results" VALUES ("43", "33", "7", "5");
INSERT INTO "results" VALUES ("44", "33", "3", "6");
INSERT INTO "results" VALUES ("45", "33", "8", "7");
INSERT INTO "results" VALUES ("46", "33", "10", "8");
INSERT INTO "results" VALUES ("47", "33", "11", "9");
INSERT INTO "results" VALUES ("48", "33", "12", "10");
INSERT INTO "results" VALUES ("49", "33", "13", "11");
INSERT INTO "results" VALUES ("50", "33", "14", "12");
INSERT INTO "results" VALUES ("51", "33", "15", "13");
INSERT INTO "results" VALUES ("52", "33", "16", "14");
INSERT INTO "results" VALUES ("53", "33", "17", "15");
INSERT INTO "results" VALUES ("54", "33", "18", "16");
INSERT INTO "results" VALUES ("55", "33", "19", "17");
INSERT INTO "results" VALUES ("56", "33", "20", "18");
INSERT INTO "results" VALUES ("57", "33", "21", "19");
INSERT INTO "results" VALUES ("58", "33", "22", "20");