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", "Kyle", "10");
INSERT INTO "Highschooler" VALUES ("102", "Sarah", "10");
INSERT INTO "Highschooler" VALUES ("103", "John", "11");
INSERT INTO "Highschooler" VALUES ("104", "Emily", "9");
INSERT INTO "Highschooler" VALUES ("105", "David", "10");
INSERT INTO "Highschooler" VALUES ("106", "Jessica", "11");
INSERT INTO "Highschooler" VALUES ("107", "Michael", "9");
INSERT INTO "Highschooler" VALUES ("108", "Ashley", "10");
INSERT INTO "Highschooler" VALUES ("109", "Chris", "12");
INSERT INTO "Highschooler" VALUES ("110", "Megan", "12");
INSERT INTO "Friend" VALUES ("101", "102");
INSERT INTO "Friend" VALUES ("101", "103");
INSERT INTO "Friend" VALUES ("101", "105");
INSERT INTO "Friend" VALUES ("102", "101");
INSERT INTO "Friend" VALUES ("103", "101");
INSERT INTO "Friend" VALUES ("105", "101");
INSERT INTO "Friend" VALUES ("104", "107");
INSERT INTO "Friend" VALUES ("107", "104");
INSERT INTO "Friend" VALUES ("106", "108");
INSERT INTO "Friend" VALUES ("108", "106");
INSERT INTO "Friend" VALUES ("109", "110");
INSERT INTO "Friend" VALUES ("110", "109");
INSERT INTO "Friend" VALUES ("101", "104");
INSERT INTO "Friend" VALUES ("104", "101");
INSERT INTO "Likes" VALUES ("101", "102");
INSERT INTO "Likes" VALUES ("101", "103");
INSERT INTO "Likes" VALUES ("102", "101");
INSERT INTO "Likes" VALUES ("103", "105");
INSERT INTO "Likes" VALUES ("104", "107");
INSERT INTO "Likes" VALUES ("105", "101");
INSERT INTO "Likes" VALUES ("106", "108");
INSERT INTO "Likes" VALUES ("107", "104");
INSERT INTO "Likes" VALUES ("108", "106");
INSERT INTO "Likes" VALUES ("109", "110");
INSERT INTO "Likes" VALUES ("110", "109");
INSERT INTO "Likes" VALUES ("101", "104");