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,
"age" VARCHAR(20),
"date_arrived" DATETIME,
"date_departed" DATETIME,
PRIMARY KEY ("dog_id")
);

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

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





INSERT INTO "Dogs" VALUES ("1", "2 years", "2023-01-10 09:00:00", "2023-01-20 15:00:00");
INSERT INTO "Dogs" VALUES ("2", "5 years", "2023-02-05 10:30:00", "2023-02-15 11:00:00");
INSERT INTO "Dogs" VALUES ("3", "6 months", "2023-03-01 08:00:00", "NULL");
INSERT INTO "Dogs" VALUES ("4", "3 years", "2023-01-15 14:00:00", "2023-01-25 16:00:00");
INSERT INTO "Dogs" VALUES ("5", "1 year", "2023-04-10 09:30:00", "2023-04-20 10:00:00");
INSERT INTO "Dogs" VALUES ("6", "4 years", "2023-05-01 12:00:00", "NULL");
INSERT INTO "Owners" VALUES ("1", "owner1@example.com");
INSERT INTO "Owners" VALUES ("2", "owner2@example.com");
INSERT INTO "Owners" VALUES ("3", "owner3@example.com");
INSERT INTO "Treatments" VALUES ("1", "1", "2023-01-12 10:00:00");
INSERT INTO "Treatments" VALUES ("2", "2", "2023-02-10 09:00:00");
INSERT INTO "Treatments" VALUES ("3", "2", "2023-02-12 14:00:00");
INSERT INTO "Treatments" VALUES ("4", "4", "2023-01-20 11:00:00");
INSERT INTO "Treatments" VALUES ("5", "6", "2023-05-05 15:00:00");