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 UNIQUE,
"name" TEXT,
"location" TEXT,
"country" TEXT,
PRIMARY KEY ("circuitId")
);

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

CREATE TABLE "races" (
"raceId" INT,
"year" INT,
"circuitId" INT,
"name" TEXT,
"date" DATE,
PRIMARY KEY ("raceId"),
FOREIGN KEY ("circuitId") REFERENCES "circuits"("circuitId")
);



INSERT INTO "circuits" VALUES ("1", "Silverstone Circuit", "Silverstone", "United Kingdom");
INSERT INTO "circuits" VALUES ("2", "Brands Hatch", "Fawkham", "United Kingdom");
INSERT INTO "circuits" VALUES ("3", "Monza", "Monza", "Italy");
INSERT INTO "circuits" VALUES ("4", "Spa-Francorchamps", "Stavelot", "Belgium");
INSERT INTO "circuits" VALUES ("5", "Circuit de Monaco", "Monaco", "Monaco");
INSERT INTO "constructors" VALUES ("1", "Mercedes");
INSERT INTO "constructors" VALUES ("2", "Ferrari");
INSERT INTO "constructors" VALUES ("3", "Red Bull Racing");
INSERT INTO "constructors" VALUES ("4", "McLaren");
INSERT INTO "races" VALUES ("101", "1975", "2", "British Grand Prix", "1975-07-20");
INSERT INTO "races" VALUES ("102", "1976", "2", "British Grand Prix", "1976-07-18");
INSERT INTO "races" VALUES ("103", "1977", "2", "British Grand Prix", "1977-07-16");
INSERT INTO "races" VALUES ("104", "1985", "1", "British Grand Prix", "1985-07-21");
INSERT INTO "races" VALUES ("105", "1986", "1", "British Grand Prix", "1986-07-20");
INSERT INTO "races" VALUES ("106", "1987", "2", "British Grand Prix", "1987-07-12");
INSERT INTO "races" VALUES ("107", "1988", "1", "British Grand Prix", "1988-07-10");
INSERT INTO "races" VALUES ("108", "1989", "1", "British Grand Prix", "1989-07-16");
INSERT INTO "races" VALUES ("109", "1990", "1", "British Grand Prix", "1990-07-15");
INSERT INTO "races" VALUES ("110", "1993", "1", "British Grand Prix", "1993-07-11");
INSERT INTO "races" VALUES ("111", "1994", "1", "British Grand Prix", "1994-07-10");
INSERT INTO "races" VALUES ("112", "1995", "1", "British Grand Prix", "1995-07-16");
INSERT INTO "races" VALUES ("113", "1996", "1", "British Grand Prix", "1996-07-14");
INSERT INTO "races" VALUES ("114", "1997", "1", "British Grand Prix", "1997-07-13");
INSERT INTO "races" VALUES ("115", "1998", "1", "British Grand Prix", "1998-07-12");
INSERT INTO "races" VALUES ("116", "1999", "1", "British Grand Prix", "1999-07-11");
INSERT INTO "races" VALUES ("117", "2000", "1", "British Grand Prix", "2000-07-09");
INSERT INTO "races" VALUES ("118", "2001", "1", "British Grand Prix", "2001-07-15");
INSERT INTO "races" VALUES ("119", "2002", "1", "British Grand Prix", "2002-07-14");
INSERT INTO "races" VALUES ("120", "2003", "1", "British Grand Prix", "2003-07-20");
INSERT INTO "races" VALUES ("121", "2004", "1", "British Grand Prix", "2004-07-18");
INSERT INTO "races" VALUES ("122", "2005", "1", "British Grand Prix", "2005-07-10");
INSERT INTO "races" VALUES ("123", "2006", "1", "British Grand Prix", "2006-07-09");
INSERT INTO "races" VALUES ("124", "2007", "1", "British Grand Prix", "2007-07-08");
INSERT INTO "races" VALUES ("125", "2008", "1", "British Grand Prix", "2008-07-13");
INSERT INTO "races" VALUES ("126", "2009", "1", "British Grand Prix", "2009-07-12");
INSERT INTO "races" VALUES ("127", "2010", "1", "British Grand Prix", "2010-07-11");
INSERT INTO "races" VALUES ("128", "2011", "1", "British Grand Prix", "2011-07-10");
INSERT INTO "races" VALUES ("129", "2012", "1", "British Grand Prix", "2012-07-08");
INSERT INTO "races" VALUES ("130", "2013", "1", "British Grand Prix", "2013-07-14");
INSERT INTO "races" VALUES ("131", "2014", "1", "British Grand Prix", "2014-07-06");
INSERT INTO "races" VALUES ("132", "2015", "1", "British Grand Prix", "2015-07-05");
INSERT INTO "races" VALUES ("133", "2016", "1", "British Grand Prix", "2016-07-10");
INSERT INTO "races" VALUES ("134", "2017", "1", "British Grand Prix", "2017-07-16");
INSERT INTO "races" VALUES ("135", "2018", "1", "British Grand Prix", "2018-07-08");
INSERT INTO "races" VALUES ("136", "2019", "1", "British Grand Prix", "2019-07-14");
INSERT INTO "races" VALUES ("137", "2020", "1", "British Grand Prix", "2020-08-02");
INSERT INTO "races" VALUES ("138", "2021", "1", "British Grand Prix", "2021-07-18");
INSERT INTO "races" VALUES ("139", "2022", "1", "British Grand Prix", "2022-07-03");