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

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





INSERT INTO "Student" VALUES ("1", "22", "101");
INSERT INTO "Student" VALUES ("2", "19", "102");
INSERT INTO "Student" VALUES ("3", "25", "101");
INSERT INTO "Student" VALUES ("4", "20", "103");
INSERT INTO "Student" VALUES ("5", "21", "104");
INSERT INTO "Student" VALUES ("6", "18", "105");
INSERT INTO "Student" VALUES ("7", "30", "101");
INSERT INTO "Student" VALUES ("8", "20", "102");
INSERT INTO "Student" VALUES ("9", "23", "103");
INSERT INTO "Student" VALUES ("10", "26", "104");
INSERT INTO "Pets" VALUES ("1", "Dog", "3");
INSERT INTO "Pets" VALUES ("2", "Cat", "5");
INSERT INTO "Pets" VALUES ("3", "Bird", "2");
INSERT INTO "Pets" VALUES ("4", "Dog", "7");
INSERT INTO "Pets" VALUES ("5", "Fish", "1");
INSERT INTO "Pets" VALUES ("6", "Cat", "4");
INSERT INTO "Pets" VALUES ("7", "Hamster", "1");
INSERT INTO "Pets" VALUES ("8", "Dog", "6");
INSERT INTO "Pets" VALUES ("9", "Snake", "3");
INSERT INTO "Pets" VALUES ("10", "Rabbit", "2");
INSERT INTO "Has_Pet" VALUES ("1", "1");
INSERT INTO "Has_Pet" VALUES ("1", "2");
INSERT INTO "Has_Pet" VALUES ("3", "3");
INSERT INTO "Has_Pet" VALUES ("3", "4");
INSERT INTO "Has_Pet" VALUES ("5", "5");
INSERT INTO "Has_Pet" VALUES ("7", "6");
INSERT INTO "Has_Pet" VALUES ("7", "7");
INSERT INTO "Has_Pet" VALUES ("9", "8");
INSERT INTO "Has_Pet" VALUES ("10", "9");
INSERT INTO "Has_Pet" VALUES ("10", "10");