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

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

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

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

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



INSERT INTO "drivers" VALUES ("1", "Lewis", "Hamilton", "1985-01-07");
INSERT INTO "drivers" VALUES ("2", "Max", "Verstappen", "1997-09-30");
INSERT INTO "drivers" VALUES ("3", "Fernando", "Alonso", "1981-07-29");
INSERT INTO "drivers" VALUES ("4", "Sebastian", "Vettel", "1987-07-03");
INSERT INTO "drivers" VALUES ("5", "Kimi", "Raikkonen", "1979-10-17");
INSERT INTO "drivers" VALUES ("6", "Michael", "Schumacher", "1969-01-03");
INSERT INTO "drivers" VALUES ("7", "Charles", "Leclerc", "1997-10-16");
INSERT INTO "drivers" VALUES ("8", "Lando", "Norris", "1999-11-13");
INSERT INTO "drivers" VALUES ("9", "George", "Russell", "1998-02-15");
INSERT INTO "drivers" VALUES ("10", "Carlos", "Sainz", "1994-09-01");
INSERT INTO "drivers" VALUES ("11", "Daniel", "Ricciardo", "1989-07-01");
INSERT INTO "drivers" VALUES ("12", "Valtteri", "Bottas", "1989-08-28");
INSERT INTO "driverStandings" VALUES ("1", "1", "1");
INSERT INTO "driverStandings" VALUES ("2", "2", "1");
INSERT INTO "driverStandings" VALUES ("3", "3", "2");
INSERT INTO "driverStandings" VALUES ("4", "4", "3");
INSERT INTO "driverStandings" VALUES ("5", "5", "2");
INSERT INTO "driverStandings" VALUES ("6", "6", "1");
INSERT INTO "driverStandings" VALUES ("7", "7", "2");
INSERT INTO "driverStandings" VALUES ("8", "8", "4");
INSERT INTO "driverStandings" VALUES ("9", "9", "2");
INSERT INTO "driverStandings" VALUES ("10", "10", "5");
INSERT INTO "driverStandings" VALUES ("11", "11", "3");
INSERT INTO "driverStandings" VALUES ("12", "12", "6");
INSERT INTO "constructors" VALUES ("1", "Mercedes");
INSERT INTO "constructors" VALUES ("2", "Red Bull");
INSERT INTO "constructors" VALUES ("3", "Aston Martin");
INSERT INTO "constructors" VALUES ("4", "Ferrari");
INSERT INTO "constructors" VALUES ("5", "McLaren");
INSERT INTO "races" VALUES ("1", "Bahrain Grand Prix");
INSERT INTO "races" VALUES ("2", "Saudi Arabian Grand Prix");
INSERT INTO "races" VALUES ("3", "Australian Grand Prix");
INSERT INTO "results" VALUES ("1", "1");
INSERT INTO "results" VALUES ("2", "2");
INSERT INTO "results" VALUES ("3", "3");