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 "Breeds" (
"breed_code" VARCHAR(10),
"breed_name" VARCHAR(80),
PRIMARY KEY ("breed_code")
);

CREATE TABLE "Dogs" (
"dog_id" INT,
"owner_id" INT,
"date_of_birth" DATETIME,
"date_arrived" DATETIME,
PRIMARY KEY ("dog_id"),
FOREIGN KEY ("owner_id") REFERENCES "Owners"("owner_id")
);

CREATE TABLE "Owners" (
"owner_id" INT UNIQUE,
"first_name" VARCHAR(50),
"last_name" VARCHAR(50),
PRIMARY KEY ("owner_id")
);





INSERT INTO "Breeds" VALUES ("BR001", "Labrador Retriever");
INSERT INTO "Breeds" VALUES ("BR002", "German Shepherd");
INSERT INTO "Breeds" VALUES ("BR003", "Beagle");
INSERT INTO "Breeds" VALUES ("BR004", "Bulldog");
INSERT INTO "Breeds" VALUES ("BR005", "Poodle");
INSERT INTO "Owners" VALUES ("1", "Alice", "Johnson");
INSERT INTO "Owners" VALUES ("2", "Bob", "Smith");
INSERT INTO "Owners" VALUES ("3", "Carol", "Williams");
INSERT INTO "Owners" VALUES ("4", "David", "Brown");
INSERT INTO "Owners" VALUES ("5", "Eva", "Davis");
INSERT INTO "Dogs" VALUES ("101", "1", "2018-05-20", "2018-06-01");
INSERT INTO "Dogs" VALUES ("102", "2", "2020-11-15", "2020-12-01");
INSERT INTO "Dogs" VALUES ("103", "3", "2022-01-10", "2022-01-20");
INSERT INTO "Dogs" VALUES ("104", "4", "2023-04-05", "2023-04-10");
INSERT INTO "Dogs" VALUES ("105", "5", "2023-04-05", "2023-04-15");
INSERT INTO "Dogs" VALUES ("106", "1", "2023-04-06", "2023-04-16");
INSERT INTO "Dogs" VALUES ("107", "2", "2023-04-06", "2023-04-17");
INSERT INTO "Dogs" VALUES ("108", "3", "2023-04-07", "2023-04-18");
INSERT INTO "Dogs" VALUES ("109", "4", "2023-04-07", "2023-04-19");
INSERT INTO "Dogs" VALUES ("110", "5", "2023-04-08", "2023-04-20");