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,
"points" FLOAT,
"position" INT,
PRIMARY KEY ("driverStandingsId")
);

CREATE TABLE "circuits" (
"circuitId" INT,
"name" TEXT,
PRIMARY KEY ("circuitId")
);

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

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

CREATE TABLE "results" (
"resultId" INT,
"raceId" INT,
"driverId" INT,
PRIMARY KEY ("resultId"),
FOREIGN KEY ("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
);



INSERT INTO "driverStandings" VALUES ("1", "25.0", "1");
INSERT INTO "driverStandings" VALUES ("2", "18.0", "2");
INSERT INTO "driverStandings" VALUES ("3", "15.0", "3");
INSERT INTO "driverStandings" VALUES ("4", "12.0", "4");
INSERT INTO "driverStandings" VALUES ("5", "10.0", "5");
INSERT INTO "driverStandings" VALUES ("6", "8.0", "6");
INSERT INTO "driverStandings" VALUES ("7", "6.0", "7");
INSERT INTO "driverStandings" VALUES ("8", "4.0", "8");
INSERT INTO "driverStandings" VALUES ("9", "2.0", "9");
INSERT INTO "driverStandings" VALUES ("10", "1.0", "10");
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 Catalunya");
INSERT INTO "circuits" VALUES ("6", "Circuit de Monaco");
INSERT INTO "circuits" VALUES ("7", "Circuit Gilles Villeneuve");
INSERT INTO "circuits" VALUES ("8", "Silverstone Circuit");
INSERT INTO "circuits" VALUES ("9", "Hockenheimring");
INSERT INTO "circuits" VALUES ("10", "Hungaroring");
INSERT INTO "drivers" VALUES ("1", "Lewis", "Hamilton");
INSERT INTO "drivers" VALUES ("2", "Sebastian", "Vettel");
INSERT INTO "drivers" VALUES ("3", "Max", "Verstappen");
INSERT INTO "drivers" VALUES ("4", "Charles", "Leclerc");
INSERT INTO "drivers" VALUES ("5", "Valtteri", "Bottas");
INSERT INTO "drivers" VALUES ("6", "Daniel", "Ricciardo");
INSERT INTO "drivers" VALUES ("7", "Fernando", "Alonso");
INSERT INTO "drivers" VALUES ("8", "Kimi", "Raikkonen");
INSERT INTO "drivers" VALUES ("9", "Sergio", "Perez");
INSERT INTO "drivers" VALUES ("10", "Lando", "Norris");
INSERT INTO "races" VALUES ("1", "2023", "Australian Grand Prix");
INSERT INTO "races" VALUES ("2", "2023", "Malaysian Grand Prix");
INSERT INTO "races" VALUES ("3", "2023", "Chinese Grand Prix");
INSERT INTO "races" VALUES ("4", "2023", "Bahrain Grand Prix");
INSERT INTO "races" VALUES ("5", "2022", "Spanish Grand Prix");
INSERT INTO "races" VALUES ("6", "2022", "Monaco Grand Prix");
INSERT INTO "races" VALUES ("7", "2022", "Canadian Grand Prix");
INSERT INTO "races" VALUES ("8", "2021", "British Grand Prix");
INSERT INTO "races" VALUES ("9", "2021", "German Grand Prix");
INSERT INTO "races" VALUES ("10", "2021", "Hungarian Grand Prix");
INSERT INTO "results" VALUES ("1", "1", "1");
INSERT INTO "results" VALUES ("2", "1", "2");
INSERT INTO "results" VALUES ("3", "2", "1");
INSERT INTO "results" VALUES ("4", "2", "3");
INSERT INTO "results" VALUES ("5", "3", "1");
INSERT INTO "results" VALUES ("6", "3", "4");
INSERT INTO "results" VALUES ("7", "4", "5");
INSERT INTO "results" VALUES ("8", "4", "6");
INSERT INTO "results" VALUES ("9", "5", "1");
INSERT INTO "results" VALUES ("10", "5", "7");
INSERT INTO "results" VALUES ("11", "6", "8");
INSERT INTO "results" VALUES ("12", "6", "9");
INSERT INTO "results" VALUES ("13", "7", "1");
INSERT INTO "results" VALUES ("14", "7", "10");
INSERT INTO "results" VALUES ("15", "8", "2");
INSERT INTO "results" VALUES ("16", "8", "3");
INSERT INTO "results" VALUES ("17", "9", "4");
INSERT INTO "results" VALUES ("18", "9", "5");
INSERT INTO "results" VALUES ("19", "10", "6");
INSERT INTO "results" VALUES ("20", "10", "7");