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 "races" (
"raceId" INT UNIQUE,
"year" INT,
"circuitId" INT,
"name" TEXT,
PRIMARY KEY ("raceId")
);

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



INSERT INTO "races" VALUES ("1", "2008", "101", "Australian Grand Prix");
INSERT INTO "races" VALUES ("2", "2008", "102", "Chinese Grand Prix");
INSERT INTO "races" VALUES ("3", "2009", "102", "Chinese Grand Prix");
INSERT INTO "races" VALUES ("4", "2008", "103", "Monaco Grand Prix");
INSERT INTO "races" VALUES ("5", "2007", "102", "Chinese Grand Prix");
INSERT INTO "results" VALUES ("1", "2", "201", "1", "25.0", "1:33:45.123");
INSERT INTO "results" VALUES ("2", "2", "202", "2", "18.0", "1:34:10.456");
INSERT INTO "results" VALUES ("3", "2", "203", "3", "15.0", "1:34:30.789");
INSERT INTO "results" VALUES ("4", "1", "204", "2", "18.0", "1:30:05.321");
INSERT INTO "results" VALUES ("5", "1", "205", "1", "25.0", "1:29:50.654");
INSERT INTO "results" VALUES ("6", "3", "201", "2", "18.0", "1:32:20.111");
INSERT INTO "results" VALUES ("7", "4", "206", "1", "25.0", "1:40:00.000");
INSERT INTO "results" VALUES ("8", "5", "207", "2", "18.0", "1:35:00.000");