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

CREATE TABLE "driverStandings" (
"driverStandingsId" INT,
"raceId" INT,
"driverId" INT,
"points" FLOAT,
"position" INT,
"wins" INT,
PRIMARY KEY ("driverStandingsId"),
FOREIGN KEY ("raceId") REFERENCES "races"("raceId"),
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,
PRIMARY KEY ("driverId")
);

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



INSERT INTO "constructorStandings" VALUES ("1", "1");
INSERT INTO "constructorStandings" VALUES ("2", "2");
INSERT INTO "constructorStandings" VALUES ("3", "3");
INSERT INTO "constructors" VALUES ("1", "Mercedes");
INSERT INTO "constructors" VALUES ("2", "Red Bull");
INSERT INTO "constructors" VALUES ("3", "Ferrari");
INSERT INTO "drivers" VALUES ("1", "Lewis", "Hamilton");
INSERT INTO "drivers" VALUES ("2", "Max", "Verstappen");
INSERT INTO "drivers" VALUES ("3", "Sebastian", "Vettel");
INSERT INTO "drivers" VALUES ("4", "Lando", "Norris");
INSERT INTO "drivers" VALUES ("5", "George", "Russell");
INSERT INTO "drivers" VALUES ("6", "Charles", "Leclerc");
INSERT INTO "drivers" VALUES ("7", "Driver91F", "Driver91S");
INSERT INTO "races" VALUES ("1", "2023", "1", "Bahrain Grand Prix", "2023-03-05");
INSERT INTO "races" VALUES ("2", "2023", "2", "Saudi Arabian Grand Prix", "2023-03-19");
INSERT INTO "races" VALUES ("3", "2023", "3", "Australian Grand Prix", "2023-04-02");
INSERT INTO "races" VALUES ("4", "2023", "4", "Azerbaijan Grand Prix", "2023-04-30");
INSERT INTO "races" VALUES ("5", "2023", "5", "Miami Grand Prix", "2023-05-07");
INSERT INTO "driverStandings" VALUES ("1", "1", "1", "25.0", "1", "1");
INSERT INTO "driverStandings" VALUES ("2", "1", "2", "18.0", "2", "0");
INSERT INTO "driverStandings" VALUES ("3", "1", "3", "15.0", "3", "0");
INSERT INTO "driverStandings" VALUES ("4", "2", "1", "18.0", "2", "0");
INSERT INTO "driverStandings" VALUES ("5", "2", "2", "25.0", "1", "1");
INSERT INTO "driverStandings" VALUES ("6", "2", "3", "12.0", "4", "0");
INSERT INTO "driverStandings" VALUES ("7", "3", "1", "15.0", "3", "0");
INSERT INTO "driverStandings" VALUES ("8", "3", "2", "25.0", "1", "1");
INSERT INTO "driverStandings" VALUES ("9", "3", "3", "10.0", "5", "0");
INSERT INTO "driverStandings" VALUES ("10", "4", "7", "10.0", "10", "1");
INSERT INTO "driverStandings" VALUES ("11", "5", "7", "8.0", "11", "0");
INSERT INTO "driverStandings" VALUES ("12", "1", "7", "5.0", "15", "0");
INSERT INTO "driverStandings" VALUES ("13", "2", "7", "7.0", "12", "0");
INSERT INTO "driverStandings" VALUES ("14", "1", "4", "11.0", "9", "0");
INSERT INTO "driverStandings" VALUES ("15", "2", "5", "11.0", "8", "0");
INSERT INTO "driverStandings" VALUES ("16", "3", "6", "11.0", "7", "0");
INSERT INTO "driverStandings" VALUES ("17", "4", "4", "9.0", "13", "0");
INSERT INTO "driverStandings" VALUES ("18", "5", "5", "9.0", "14", "0");
INSERT INTO "driverStandings" VALUES ("19", "3", "6", "9.0", "16", "0");