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

CREATE TABLE "Student" (
"StuID" INT UNIQUE,
"Age" INT,
"Sex" VARCHAR(1),
"Major" INT,
PRIMARY KEY ("StuID")
);





INSERT INTO "Pets" VALUES ("1", "dog", "3");
INSERT INTO "Pets" VALUES ("2", "Cat", "5");
INSERT INTO "Pets" VALUES ("3", "dog", "2");
INSERT INTO "Pets" VALUES ("4", "Bird", "1");
INSERT INTO "Pets" VALUES ("5", "dog", "4");
INSERT INTO "Pets" VALUES ("6", "Fish", "1");
INSERT INTO "Pets" VALUES ("7", "dog", "6");
INSERT INTO "Pets" VALUES ("8", "Cat", "2");
INSERT INTO "Pets" VALUES ("9", "dog", "3");
INSERT INTO "Pets" VALUES ("10", "Rabbit", "1");
INSERT INTO "Student" VALUES ("101", "20", "F", "1");
INSERT INTO "Student" VALUES ("102", "22", "M", "2");
INSERT INTO "Student" VALUES ("103", "21", "F", "1");
INSERT INTO "Student" VALUES ("104", "19", "M", "3");
INSERT INTO "Student" VALUES ("105", "23", "F", "2");
INSERT INTO "Student" VALUES ("106", "20", "M", "1");
INSERT INTO "Student" VALUES ("107", "21", "F", "3");
INSERT INTO "Student" VALUES ("108", "22", "M", "2");
INSERT INTO "Student" VALUES ("109", "19", "F", "1");
INSERT INTO "Student" VALUES ("110", "20", "M", "3");
INSERT INTO "Has_Pet" VALUES ("101", "1");
INSERT INTO "Has_Pet" VALUES ("101", "2");
INSERT INTO "Has_Pet" VALUES ("103", "3");
INSERT INTO "Has_Pet" VALUES ("102", "4");
INSERT INTO "Has_Pet" VALUES ("105", "5");
INSERT INTO "Has_Pet" VALUES ("104", "6");
INSERT INTO "Has_Pet" VALUES ("107", "7");
INSERT INTO "Has_Pet" VALUES ("106", "8");
INSERT INTO "Has_Pet" VALUES ("109", "9");
INSERT INTO "Has_Pet" VALUES ("108", "10");
INSERT INTO "Has_Pet" VALUES ("101", "7");
INSERT INTO "Has_Pet" VALUES ("103", "1");
INSERT INTO "Has_Pet" VALUES ("105", "3");
INSERT INTO "Has_Pet" VALUES ("107", "5");
INSERT INTO "Has_Pet" VALUES ("109", "7");