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 UNIQUE,
"owner_id" INT,
"breed_code" VARCHAR(10),
"size_code" VARCHAR(10),
"name" VARCHAR(50),
PRIMARY KEY ("dog_id"),
FOREIGN KEY ("breed_code") REFERENCES "Breeds"("breed_code")
);

CREATE TABLE "Treatments" (
"treatment_id" INT,
"dog_id" INT,
"professional_id" INT,
"date_of_treatment" DATETIME,
PRIMARY KEY ("treatment_id"),
FOREIGN KEY ("dog_id") REFERENCES "Dogs"("dog_id")
);





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", "Chow Chow");
INSERT INTO "Breeds" VALUES ("BR006", "Azawakh");
INSERT INTO "Breeds" VALUES ("BR007", "Norwegian Lundehund");
INSERT INTO "Dogs" VALUES ("1", "101", "BR001", "S", "Buddy");
INSERT INTO "Dogs" VALUES ("2", "102", "BR001", "M", "Max");
INSERT INTO "Dogs" VALUES ("3", "103", "BR002", "L", "Rex");
INSERT INTO "Dogs" VALUES ("4", "104", "BR003", "M", "Bella");
INSERT INTO "Dogs" VALUES ("5", "105", "BR004", "S", "Charlie");
INSERT INTO "Dogs" VALUES ("6", "106", "BR005", "M", "Daisy");
INSERT INTO "Dogs" VALUES ("7", "107", "BR006", "M", "Zazu");
INSERT INTO "Dogs" VALUES ("8", "108", "BR007", "S", "Loki");
INSERT INTO "Dogs" VALUES ("9", "109", "BR007", "S", "Nina");
INSERT INTO "Treatments" VALUES ("1", "1", "201", "2023-01-15 10:00:00");
INSERT INTO "Treatments" VALUES ("2", "1", "202", "2023-03-20 14:30:00");
INSERT INTO "Treatments" VALUES ("3", "2", "201", "2023-02-10 09:00:00");
INSERT INTO "Treatments" VALUES ("4", "3", "203", "2023-01-25 11:00:00");
INSERT INTO "Treatments" VALUES ("5", "4", "204", "2023-04-05 15:00:00");
INSERT INTO "Treatments" VALUES ("6", "5", "205", "2023-03-15 13:00:00");
INSERT INTO "Treatments" VALUES ("7", "6", "206", "2023-02-28 16:00:00");
INSERT INTO "Treatments" VALUES ("8", "7", "207", "2023-05-01 10:30:00");
INSERT INTO "Treatments" VALUES ("9", "8", "208", "2023-06-10 09:45:00");
INSERT INTO "Treatments" VALUES ("10", "9", "208", "2023-06-15 10:15:00");