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 "Addresses" (
"address_id" INT UNIQUE,
"state_province_county" VARCHAR(255),
PRIMARY KEY ("address_id")
);

CREATE TABLE "Degree_Programs" (
"degree_program_id" INT,
"degree_summary_name" VARCHAR(255),
PRIMARY KEY ("degree_program_id")
);

CREATE TABLE "Student_Enrolment" (
"student_enrolment_id" INT,
"degree_program_id" INT,
"student_id" INT,
PRIMARY KEY ("student_enrolment_id"),
FOREIGN KEY ("student_id") REFERENCES "Students"("student_id"),
FOREIGN KEY ("degree_program_id") REFERENCES "Degree_Programs"("degree_program_id")
);

CREATE TABLE "Students" (
"student_id" INT UNIQUE,
"current_address_id" INT,
"permanent_address_id" INT,
"first_name" VARCHAR(80),
"last_name" VARCHAR(40),
"email_address" VARCHAR(40),
PRIMARY KEY ("student_id"),
FOREIGN KEY ("permanent_address_id") REFERENCES "Addresses"("address_id"),
FOREIGN KEY ("current_address_id") REFERENCES "Addresses"("address_id")
);





INSERT INTO "Addresses" VALUES ("1", "North Carolina");
INSERT INTO "Addresses" VALUES ("2", "California");
INSERT INTO "Addresses" VALUES ("3", "North Carolina");
INSERT INTO "Addresses" VALUES ("4", "New York");
INSERT INTO "Addresses" VALUES ("5", "North Carolina");
INSERT INTO "Addresses" VALUES ("6", "Texas");
INSERT INTO "Addresses" VALUES ("7", "North Carolina");
INSERT INTO "Addresses" VALUES ("8", "Florida");
INSERT INTO "Addresses" VALUES ("9", "North Carolina");
INSERT INTO "Addresses" VALUES ("10", "Virginia");
INSERT INTO "Degree_Programs" VALUES ("1", "Computer Science");
INSERT INTO "Degree_Programs" VALUES ("2", "Electrical Engineering");
INSERT INTO "Degree_Programs" VALUES ("3", "Business Administration");
INSERT INTO "Degree_Programs" VALUES ("4", "Psychology");
INSERT INTO "Degree_Programs" VALUES ("5", "Biology");
INSERT INTO "Students" VALUES ("1", "1", "1", "Alice", "Smith", "alice.smith@example.com");
INSERT INTO "Students" VALUES ("2", "2", "2", "Bob", "Johnson", "bob.j@example.com");
INSERT INTO "Students" VALUES ("3", "3", "3", "Charlie", "Brown", "charlie.b@example.com");
INSERT INTO "Students" VALUES ("4", "4", "4", "Diana", "Miller", "diana.m@example.com");
INSERT INTO "Students" VALUES ("5", "5", "5", "Eve", "Davis", "eve.d@example.com");
INSERT INTO "Students" VALUES ("6", "6", "6", "Frank", "Garcia", "frank.g@example.com");
INSERT INTO "Students" VALUES ("7", "7", "7", "Grace", "Rodriguez", "grace.r@example.com");
INSERT INTO "Students" VALUES ("8", "8", "8", "Henry", "Martinez", "henry.m@example.com");
INSERT INTO "Students" VALUES ("9", "9", "9", "Ivy", "Hernandez", "ivy.h@example.com");
INSERT INTO "Students" VALUES ("10", "10", "10", "Jack", "Lopez", "jack.l@example.com");
INSERT INTO "Students" VALUES ("11", "1", "1", "Olivia", "Wilson", "olivia.w@example.com");
INSERT INTO "Students" VALUES ("12", "3", "3", "Liam", "Moore", "liam.m@example.com");
INSERT INTO "Students" VALUES ("13", "5", "5", "Sophia", "Taylor", "sophia.t@example.com");
INSERT INTO "Students" VALUES ("14", "7", "7", "Noah", "Anderson", "noah.a@example.com");
INSERT INTO "Students" VALUES ("15", "9", "9", "Emma", "Thomas", "emma.t@example.com");
INSERT INTO "Student_Enrolment" VALUES ("1", "1", "1");
INSERT INTO "Student_Enrolment" VALUES ("2", "2", "2");
INSERT INTO "Student_Enrolment" VALUES ("3", "3", "4");
INSERT INTO "Student_Enrolment" VALUES ("4", "4", "6");
INSERT INTO "Student_Enrolment" VALUES ("5", "5", "8");
INSERT INTO "Student_Enrolment" VALUES ("6", "1", "10");
INSERT INTO "Student_Enrolment" VALUES ("7", "2", "11");
INSERT INTO "Student_Enrolment" VALUES ("8", "3", "12");
INSERT INTO "Student_Enrolment" VALUES ("9", "4", "14");