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

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

CREATE TABLE "Treatments" (
"treatment_id" INT,
"dog_id" INT,
"date_of_treatment" DATETIME,
"cost_of_treatment" DECIMAL(19, 4),
PRIMARY KEY ("treatment_id"),
FOREIGN KEY ("dog_id") REFERENCES "Dogs"("dog_id")
);





INSERT INTO "Owners" VALUES ("1", "New York");
INSERT INTO "Owners" VALUES ("2", "Los Angeles");
INSERT INTO "Owners" VALUES ("3", "Chicago");
INSERT INTO "Owners" VALUES ("4", "Houston");
INSERT INTO "Owners" VALUES ("5", "Phoenix");
INSERT INTO "Dogs" VALUES ("101", "1", "BC01", "Buddy");
INSERT INTO "Dogs" VALUES ("102", "1", "BC02", "Max");
INSERT INTO "Dogs" VALUES ("103", "2", "BC01", "Bella");
INSERT INTO "Dogs" VALUES ("104", "3", "BC03", "Charlie");
INSERT INTO "Dogs" VALUES ("105", "4", "BC02", "Lucy");
INSERT INTO "Dogs" VALUES ("106", "5", "BC04", "Daisy");
INSERT INTO "Dogs" VALUES ("107", "5", "BC01", "Molly");
INSERT INTO "Dogs" VALUES ("108", "3", "BC04", "Bailey");
INSERT INTO "Treatments" VALUES ("201", "101", "2023-01-10 10:00:00", "300.00");
INSERT INTO "Treatments" VALUES ("202", "101", "2023-03-15 11:30:00", "400.00");
INSERT INTO "Treatments" VALUES ("203", "102", "2023-02-20 09:00:00", "1200.00");
INSERT INTO "Treatments" VALUES ("204", "103", "2023-01-25 14:00:00", "500.00");
INSERT INTO "Treatments" VALUES ("205", "103", "2023-04-10 15:00:00", "300.00");
INSERT INTO "Treatments" VALUES ("206", "104", "2023-05-05 16:00:00", "1000.00");
INSERT INTO "Treatments" VALUES ("207", "105", "2023-06-01 10:00:00", "999.99");
INSERT INTO "Treatments" VALUES ("208", "106", "2023-07-10 12:00:00", "1500.00");
INSERT INTO "Treatments" VALUES ("209", "107", "2023-08-15 13:00:00", "200.00");
INSERT INTO "Treatments" VALUES ("210", "107", "2023-09-20 14:00:00", "300.00");
INSERT INTO "Treatments" VALUES ("211", "108", "2023-10-25 15:00:00", "0.00");