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,
PRIMARY KEY ("circuitId")
);

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, UK");
INSERT INTO "circuits" VALUES ("2", "Monza Circuit", "Monza, Italy");
INSERT INTO "circuits" VALUES ("3", "Spa-Francorchamps", "Stavelot, Belgium");
INSERT INTO "circuits" VALUES ("4", "Suzuka Circuit", "Suzuka, Japan");
INSERT INTO "circuits" VALUES ("5", "Interlagos", "São Paulo, Brazil");
INSERT INTO "circuits" VALUES ("6", "Circuit de Monaco", "Monaco");
INSERT INTO "circuits" VALUES ("7", "Hockenheimring", "Hockenheim, Germany");
INSERT INTO "races" VALUES ("101", "1990", "1", "British Grand Prix 1990", "1990-07-15");
INSERT INTO "races" VALUES ("102", "1993", "1", "British Grand Prix 1993", "1993-07-11");
INSERT INTO "races" VALUES ("103", "1997", "1", "British Grand Prix 1997", "1997-07-13");
INSERT INTO "races" VALUES ("104", "2000", "1", "British Grand Prix 2000", "2000-07-16");
INSERT INTO "races" VALUES ("201", "1990", "2", "Italian Grand Prix 1990", "1990-09-09");
INSERT INTO "races" VALUES ("202", "1992", "2", "Italian Grand Prix 1992", "1992-09-06");
INSERT INTO "races" VALUES ("203", "1995", "2", "Italian Grand Prix 1995", "1995-09-10");
INSERT INTO "races" VALUES ("204", "1998", "2", "Italian Grand Prix 1998", "1998-09-13");
INSERT INTO "races" VALUES ("205", "2000", "2", "Italian Grand Prix 2000", "2000-09-10");
INSERT INTO "races" VALUES ("301", "1991", "3", "Belgian Grand Prix 1991", "1991-08-25");
INSERT INTO "races" VALUES ("302", "1994", "3", "Belgian Grand Prix 1994", "1994-08-28");
INSERT INTO "races" VALUES ("303", "1999", "3", "Belgian Grand Prix 1999", "1999-08-29");
INSERT INTO "races" VALUES ("401", "1990", "4", "Japanese Grand Prix 1990", "1990-10-21");
INSERT INTO "races" VALUES ("402", "1993", "4", "Japanese Grand Prix 1993", "1993-10-24");
INSERT INTO "races" VALUES ("403", "1996", "4", "Japanese Grand Prix 1996", "1996-10-27");
INSERT INTO "races" VALUES ("404", "2000", "4", "Japanese Grand Prix 2000", "2000-10-08");
INSERT INTO "races" VALUES ("501", "1992", "5", "Brazilian Grand Prix 1992", "1992-03-29");
INSERT INTO "races" VALUES ("502", "1997", "5", "Brazilian Grand Prix 1997", "1997-03-30");
INSERT INTO "races" VALUES ("601", "1989", "6", "Monaco Grand Prix 1989", "1989-05-14");
INSERT INTO "races" VALUES ("602", "1991", "6", "Monaco Grand Prix 1991", "1991-05-12");
INSERT INTO "races" VALUES ("603", "1994", "6", "Monaco Grand Prix 1994", "1994-05-15");
INSERT INTO "races" VALUES ("604", "1997", "6", "Monaco Grand Prix 1997", "1997-05-11");
INSERT INTO "races" VALUES ("701", "1993", "7", "German Grand Prix 1993", "1993-07-25");
INSERT INTO "races" VALUES ("702", "1996", "7", "German Grand Prix 1996", "1996-07-28");
INSERT INTO "races" VALUES ("703", "1999", "7", "German Grand Prix 1999", "1999-07-25");
INSERT INTO "races" VALUES ("704", "2001", "7", "German Grand Prix 2001", "2001-07-29");