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 "circuits" (
"circuitId" INT,
"name" TEXT,
PRIMARY KEY ("circuitId")
);

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

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



INSERT INTO "circuits" VALUES ("1", "Albert Park Grand Prix Circuit");
INSERT INTO "circuits" VALUES ("2", "Sepang International Circuit");
INSERT INTO "circuits" VALUES ("3", "Shanghai International Circuit");
INSERT INTO "circuits" VALUES ("4", "Bahrain International Circuit");
INSERT INTO "circuits" VALUES ("5", "Circuit de Barcelona-Catalunya");
INSERT INTO "circuits" VALUES ("6", "Circuit de Monaco");
INSERT INTO "circuits" VALUES ("7", "Circuit Gilles Villeneuve");
INSERT INTO "circuits" VALUES ("8", "Red Bull Ring");
INSERT INTO "circuits" VALUES ("9", "Silverstone Circuit");
INSERT INTO "circuits" VALUES ("10", "Hockenheimring");
INSERT INTO "races" VALUES ("1", "2000", "Australian Grand Prix", "2000-03-12");
INSERT INTO "races" VALUES ("2", "2000", "Malaysian Grand Prix", "2000-03-19");
INSERT INTO "races" VALUES ("3", "2000", "Chinese Grand Prix", "2000-04-09");
INSERT INTO "races" VALUES ("4", "2001", "Australian Grand Prix", "2001-03-04");
INSERT INTO "races" VALUES ("5", "2001", "Malaysian Grand Prix", "2001-03-18");
INSERT INTO "races" VALUES ("6", "2001", "Brazilian Grand Prix", "2001-03-25");
INSERT INTO "races" VALUES ("7", "2002", "Australian Grand Prix", "2002-03-03");
INSERT INTO "races" VALUES ("8", "2002", "Malaysian Grand Prix", "2002-03-17");
INSERT INTO "races" VALUES ("9", "2002", "Bahrain Grand Prix", "2002-04-07");
INSERT INTO "races" VALUES ("10", "2003", "Australian Grand Prix", "2003-03-09");
INSERT INTO "races" VALUES ("11", "2003", "Malaysian Grand Prix", "2003-03-23");
INSERT INTO "races" VALUES ("12", "2003", "Spanish Grand Prix", "2003-05-04");
INSERT INTO "races" VALUES ("13", "2004", "Australian Grand Prix", "2004-03-07");
INSERT INTO "races" VALUES ("14", "2004", "Malaysian Grand Prix", "2004-03-21");
INSERT INTO "races" VALUES ("15", "2004", "Monaco Grand Prix", "2004-05-23");
INSERT INTO "races" VALUES ("16", "2005", "Australian Grand Prix", "2005-03-06");
INSERT INTO "races" VALUES ("17", "2005", "Bahrain Grand Prix", "2005-04-03");
INSERT INTO "races" VALUES ("18", "2005", "Canadian Grand Prix", "2005-06-12");
INSERT INTO "races" VALUES ("19", "2006", "Australian Grand Prix", "2006-03-12");
INSERT INTO "races" VALUES ("20", "2006", "Bahrain Grand Prix", "2006-03-12");
INSERT INTO "races" VALUES ("21", "2006", "British Grand Prix", "2006-06-11");
INSERT INTO "races" VALUES ("22", "2007", "Australian Grand Prix", "2007-03-18");
INSERT INTO "races" VALUES ("23", "2007", "Malaysian Grand Prix", "2007-04-08");
INSERT INTO "races" VALUES ("24", "2007", "German Grand Prix", "2007-07-22");
INSERT INTO "results" VALUES ("1", "1", "1");
INSERT INTO "results" VALUES ("2", "2", "2");
INSERT INTO "results" VALUES ("3", "3", "3");
INSERT INTO "results" VALUES ("4", "4", "1");
INSERT INTO "results" VALUES ("5", "5", "2");
INSERT INTO "results" VALUES ("6", "6", "3");
INSERT INTO "results" VALUES ("7", "7", "1");
INSERT INTO "results" VALUES ("8", "8", "2");
INSERT INTO "results" VALUES ("9", "9", "3");
INSERT INTO "results" VALUES ("10", "10", "1");
INSERT INTO "results" VALUES ("11", "11", "2");
INSERT INTO "results" VALUES ("12", "12", "3");
INSERT INTO "results" VALUES ("13", "13", "1");
INSERT INTO "results" VALUES ("14", "14", "2");
INSERT INTO "results" VALUES ("15", "15", "3");
INSERT INTO "results" VALUES ("16", "16", "1");
INSERT INTO "results" VALUES ("17", "17", "2");
INSERT INTO "results" VALUES ("18", "18", "3");
INSERT INTO "results" VALUES ("19", "19", "1");
INSERT INTO "results" VALUES ("20", "20", "2");
INSERT INTO "results" VALUES ("21", "21", "3");
INSERT INTO "results" VALUES ("22", "22", "1");
INSERT INTO "results" VALUES ("23", "23", "2");
INSERT INTO "results" VALUES ("24", "24", "3");