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 "Friend" (
"student_id" INT,
"friend_id" INT,
PRIMARY KEY ("student_id", "friend_id"),
FOREIGN KEY ("student_id") REFERENCES "Highschooler"("ID"),
FOREIGN KEY ("friend_id") REFERENCES "Highschooler"("ID")
);

CREATE TABLE "Highschooler" (
"ID" INT UNIQUE,
"name" TEXT,
"grade" INT,
PRIMARY KEY ("ID")
);

CREATE TABLE "Likes" (
"student_id" INT,
"liked_id" INT,
PRIMARY KEY ("student_id", "liked_id"),
FOREIGN KEY ("liked_id") REFERENCES "Highschooler"("ID"),
FOREIGN KEY ("student_id") REFERENCES "Highschooler"("ID")
);





INSERT INTO "Highschooler" VALUES ("101", "Alice", "10");
INSERT INTO "Highschooler" VALUES ("102", "Bob", "10");
INSERT INTO "Highschooler" VALUES ("103", "Charlie", "11");
INSERT INTO "Highschooler" VALUES ("104", "David", "11");
INSERT INTO "Highschooler" VALUES ("105", "Eve", "9");
INSERT INTO "Highschooler" VALUES ("106", "Frank", "9");
INSERT INTO "Highschooler" VALUES ("107", "Grace", "12");
INSERT INTO "Highschooler" VALUES ("108", "Heidi", "12");
INSERT INTO "Highschooler" VALUES ("109", "Ivan", "10");
INSERT INTO "Highschooler" VALUES ("110", "Judy", "11");
INSERT INTO "Friend" VALUES ("101", "102");
INSERT INTO "Friend" VALUES ("102", "101");
INSERT INTO "Friend" VALUES ("103", "104");
INSERT INTO "Friend" VALUES ("104", "103");
INSERT INTO "Friend" VALUES ("101", "103");
INSERT INTO "Friend" VALUES ("105", "106");
INSERT INTO "Friend" VALUES ("107", "108");
INSERT INTO "Friend" VALUES ("109", "101");
INSERT INTO "Friend" VALUES ("110", "104");
INSERT INTO "Likes" VALUES ("101", "103");
INSERT INTO "Likes" VALUES ("101", "104");
INSERT INTO "Likes" VALUES ("102", "101");
INSERT INTO "Likes" VALUES ("103", "101");
INSERT INTO "Likes" VALUES ("103", "102");
INSERT INTO "Likes" VALUES ("104", "101");
INSERT INTO "Likes" VALUES ("105", "107");
INSERT INTO "Likes" VALUES ("106", "107");
INSERT INTO "Likes" VALUES ("107", "105");
INSERT INTO "Likes" VALUES ("107", "106");
INSERT INTO "Likes" VALUES ("107", "108");
INSERT INTO "Likes" VALUES ("108", "107");
INSERT INTO "Likes" VALUES ("109", "101");
INSERT INTO "Likes" VALUES ("109", "102");
INSERT INTO "Likes" VALUES ("109", "103");
INSERT INTO "Likes" VALUES ("110", "104");