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

CREATE TABLE "Dogs" (
"dog_id" INT,
"owner_id" INT,
"breed_code" VARCHAR(10),
"size_code" VARCHAR(10),
"age" VARCHAR(20),
"gender" VARCHAR(1),
PRIMARY KEY ("dog_id"),
FOREIGN KEY ("size_code") REFERENCES "Sizes"("size_code"),
FOREIGN KEY ("breed_code") REFERENCES "Breeds"("breed_code")
);

CREATE TABLE "Sizes" (
"size_code" VARCHAR(10) UNIQUE,
"size_description" VARCHAR(80),
PRIMARY KEY ("size_code")
);





INSERT INTO "Breeds" VALUES ("BR001", "Labrador Retriever");
INSERT INTO "Breeds" VALUES ("BR002", "German Shepherd");
INSERT INTO "Breeds" VALUES ("BR003", "Bulldog");
INSERT INTO "Breeds" VALUES ("BR004", "Beagle");
INSERT INTO "Breeds" VALUES ("BR005", "Poodle");
INSERT INTO "Breeds" VALUES ("BR006", "Chihuahua");
INSERT INTO "Breeds" VALUES ("BR007", "Siberian Husky");
INSERT INTO "Breeds" VALUES ("BR008", "Dachshund");
INSERT INTO "Breeds" VALUES ("BR009", "Great Dane");
INSERT INTO "Breeds" VALUES ("BR010", "Boxer");
INSERT INTO "Sizes" VALUES ("SZ01", "Small");
INSERT INTO "Sizes" VALUES ("SZ02", "Medium");
INSERT INTO "Sizes" VALUES ("SZ03", "Large");
INSERT INTO "Sizes" VALUES ("SZ04", "Extra Large");
INSERT INTO "Dogs" VALUES ("1", "101", "BR001", "SZ03", "5", "M");
INSERT INTO "Dogs" VALUES ("2", "102", "BR002", "SZ03", "3", "F");
INSERT INTO "Dogs" VALUES ("3", "103", "BR003", "SZ02", "7", "M");
INSERT INTO "Dogs" VALUES ("4", "104", "BR004", "SZ02", "2", "F");
INSERT INTO "Dogs" VALUES ("5", "105", "BR005", "SZ01", "4", "M");
INSERT INTO "Dogs" VALUES ("6", "106", "BR006", "SZ01", "1", "F");
INSERT INTO "Dogs" VALUES ("7", "107", "BR007", "SZ04", "6", "M");
INSERT INTO "Dogs" VALUES ("8", "108", "BR008", "SZ01", "8", "F");
INSERT INTO "Dogs" VALUES ("9", "109", "BR009", "SZ04", "9", "M");
INSERT INTO "Dogs" VALUES ("10", "110", "BR010", "SZ03", "3", "F");
INSERT INTO "Dogs" VALUES ("11", "111", "BR001", "SZ02", "2", "F");
INSERT INTO "Dogs" VALUES ("12", "112", "BR002", "SZ04", "5", "M");
INSERT INTO "Dogs" VALUES ("13", "113", "BR003", "SZ03", "4", "F");
INSERT INTO "Dogs" VALUES ("14", "114", "BR004", "SZ01", "7", "M");
INSERT INTO "Dogs" VALUES ("15", "115", "BR005", "SZ02", "6", "F");
INSERT INTO "Dogs" VALUES ("16", "116", "BR006", "SZ02", "3", "M");
INSERT INTO "Dogs" VALUES ("17", "117", "BR007", "SZ03", "2", "F");
INSERT INTO "Dogs" VALUES ("18", "118", "BR008", "SZ02", "1", "M");
INSERT INTO "Dogs" VALUES ("19", "119", "BR009", "SZ03", "8", "F");
INSERT INTO "Dogs" VALUES ("20", "120", "BR010", "SZ04", "5", "M");