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 "Professionals" (
"professional_id" INT UNIQUE,
"role_code" VARCHAR(10),
"last_name" VARCHAR(50),
"cell_number" VARCHAR(20),
PRIMARY KEY ("professional_id")
);

CREATE TABLE "Treatment_Types" (
"treatment_type_code" VARCHAR(10),
"treatment_type_description" VARCHAR(80),
PRIMARY KEY ("treatment_type_code")
);

CREATE TABLE "Treatments" (
"treatment_id" INT,
"professional_id" INT,
"treatment_type_code" VARCHAR(10),
PRIMARY KEY ("treatment_id"),
FOREIGN KEY ("professional_id") REFERENCES "Professionals"("professional_id"),
FOREIGN KEY ("treatment_type_code") REFERENCES "Treatment_Types"("treatment_type_code")
);





INSERT INTO "Professionals" VALUES ("1", "VET", "Smith", "555-1234");
INSERT INTO "Professionals" VALUES ("2", "TECH", "Johnson", "555-5678");
INSERT INTO "Professionals" VALUES ("3", "VET", "Williams", "555-8765");
INSERT INTO "Professionals" VALUES ("4", "TECH", "Brown", "555-4321");
INSERT INTO "Professionals" VALUES ("5", "VET", "Jones", "555-0000");
INSERT INTO "Treatment_Types" VALUES ("T01", "Vaccination");
INSERT INTO "Treatment_Types" VALUES ("T02", "Deworming");
INSERT INTO "Treatment_Types" VALUES ("T03", "Grooming");
INSERT INTO "Treatment_Types" VALUES ("T04", "Surgery");
INSERT INTO "Treatment_Types" VALUES ("T05", "Dental Cleaning");
INSERT INTO "Treatments" VALUES ("101", "1", "T01");
INSERT INTO "Treatments" VALUES ("102", "1", "T02");
INSERT INTO "Treatments" VALUES ("103", "2", "T01");
INSERT INTO "Treatments" VALUES ("104", "2", "T01");
INSERT INTO "Treatments" VALUES ("105", "3", "T03");
INSERT INTO "Treatments" VALUES ("106", "3", "T04");
INSERT INTO "Treatments" VALUES ("107", "3", "T05");
INSERT INTO "Treatments" VALUES ("108", "4", "T02");
INSERT INTO "Treatments" VALUES ("109", "5", "T05");
INSERT INTO "Treatments" VALUES ("110", "5", "T05");