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 "Has_Pet" (
"StuID" INT,
"PetID" INT,
FOREIGN KEY ("PetID") REFERENCES "Pets"("PetID"),
FOREIGN KEY ("StuID") REFERENCES "Student"("StuID")
);

CREATE TABLE "Pets" (
"PetID" INT UNIQUE,
"PetType" VARCHAR(20),
"pet_age" INT,
"weight" FLOAT,
PRIMARY KEY ("PetID")
);

CREATE TABLE "Student" (
"StuID" INT UNIQUE,
"LName" VARCHAR(12),
"Fname" VARCHAR(12),
"Age" INT,
PRIMARY KEY ("StuID")
);





INSERT INTO "Student" VALUES ("1", "Smith", "John", "20");
INSERT INTO "Student" VALUES ("2", "Johnson", "Emily", "22");
INSERT INTO "Student" VALUES ("3", "Williams", "Michael", "19");
INSERT INTO "Student" VALUES ("4", "Brown", "Jessica", "21");
INSERT INTO "Student" VALUES ("5", "Jones", "David", "23");
INSERT INTO "Pets" VALUES ("101", "cat", "3", "4.5");
INSERT INTO "Pets" VALUES ("102", "dog", "5", "20.0");
INSERT INTO "Pets" VALUES ("103", "cat", "2", "3.2");
INSERT INTO "Pets" VALUES ("104", "rabbit", "1", "1.1");
INSERT INTO "Pets" VALUES ("105", "cat", "3", "5.0");
INSERT INTO "Pets" VALUES ("106", "dog", "3", "18.0");
INSERT INTO "Has_Pet" VALUES ("1", "101");
INSERT INTO "Has_Pet" VALUES ("2", "102");
INSERT INTO "Has_Pet" VALUES ("3", "103");
INSERT INTO "Has_Pet" VALUES ("4", "104");
INSERT INTO "Has_Pet" VALUES ("5", "105");
INSERT INTO "Has_Pet" VALUES ("2", "106");