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,
"pet_age" INT,
PRIMARY KEY ("PetID")
);

CREATE TABLE "Student" (
"StuID" INT UNIQUE,
"Age" INT,
PRIMARY KEY ("StuID")
);





INSERT INTO "Pets" VALUES ("1", "2");
INSERT INTO "Pets" VALUES ("2", "5");
INSERT INTO "Pets" VALUES ("3", "1");
INSERT INTO "Pets" VALUES ("4", "8");
INSERT INTO "Pets" VALUES ("5", "3");
INSERT INTO "Pets" VALUES ("6", "10");
INSERT INTO "Pets" VALUES ("7", "4");
INSERT INTO "Student" VALUES ("101", "18");
INSERT INTO "Student" VALUES ("102", "20");
INSERT INTO "Student" VALUES ("103", "19");
INSERT INTO "Student" VALUES ("104", "22");
INSERT INTO "Student" VALUES ("105", "21");
INSERT INTO "Student" VALUES ("106", "20");
INSERT INTO "Student" VALUES ("107", "18");
INSERT INTO "Student" VALUES ("108", "25");
INSERT INTO "Student" VALUES ("109", "19");
INSERT INTO "Student" VALUES ("110", "23");
INSERT INTO "Has_Pet" VALUES ("101", "1");
INSERT INTO "Has_Pet" VALUES ("101", "2");
INSERT INTO "Has_Pet" VALUES ("102", "3");
INSERT INTO "Has_Pet" VALUES ("104", "4");
INSERT INTO "Has_Pet" VALUES ("105", "5");
INSERT INTO "Has_Pet" VALUES ("105", "6");
INSERT INTO "Has_Pet" VALUES ("107", "7");