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,
"nationality" TEXT,
PRIMARY KEY ("constructorId")
);

CREATE TABLE "races" (
"raceId" INT,
"circuitId" INT,
PRIMARY KEY ("raceId"),
FOREIGN KEY ("circuitId") REFERENCES "circuits"("circuitId")
);



INSERT INTO "circuits" VALUES ("1", "Adelaide Street Circuit", "Adelaide", "Australia");
INSERT INTO "circuits" VALUES ("2", "Albert Park Circuit", "Melbourne", "Australia");
INSERT INTO "circuits" VALUES ("3", "Sydney Motorsport Park", "Sydney", "Australia");
INSERT INTO "circuits" VALUES ("4", "Adelaide Grand Prix Circuit", "Adelaide", "Australia");
INSERT INTO "circuits" VALUES ("5", "Phillip Island Circuit", "Phillip Island", "Australia");
INSERT INTO "circuits" VALUES ("6", "Adelaide International Raceway", "Adelaide", "Australia");
INSERT INTO "circuits" VALUES ("7", "Mount Panorama Circuit", "Bathurst", "Australia");
INSERT INTO "circuits" VALUES ("8", "Adelaide Parklands Circuit", "Adelaide", "Australia");
INSERT INTO "circuits" VALUES ("9", "Perth Raceway", "Perth", "Australia");
INSERT INTO "circuits" VALUES ("10", "Gold Coast Circuit", "Gold Coast", "Australia");
INSERT INTO "constructors" VALUES ("1", "Australian");
INSERT INTO "constructors" VALUES ("2", "British");
INSERT INTO "constructors" VALUES ("3", "Italian");
INSERT INTO "constructors" VALUES ("4", "German");
INSERT INTO "constructors" VALUES ("5", "French");
INSERT INTO "races" VALUES ("1", "1");
INSERT INTO "races" VALUES ("2", "2");
INSERT INTO "races" VALUES ("3", "3");
INSERT INTO "races" VALUES ("4", "4");
INSERT INTO "races" VALUES ("5", "5");
INSERT INTO "races" VALUES ("6", "6");
INSERT INTO "races" VALUES ("7", "7");
INSERT INTO "races" VALUES ("8", "8");
INSERT INTO "races" VALUES ("9", "9");
INSERT INTO "races" VALUES ("10", "10");