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,
"line_1" VARCHAR(255),
"line_2" VARCHAR(255),
"line_3" VARCHAR(255),
"city" VARCHAR(255),
"zip_postcode" VARCHAR(20),
"state_province_county" VARCHAR(255),
"country" VARCHAR(255),
"other_address_details" 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,
"semester_id" INT,
PRIMARY KEY ("student_enrolment_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),
"middle_name" VARCHAR(40),
"last_name" VARCHAR(40),
"cell_mobile_number" VARCHAR(40),
"email_address" VARCHAR(40),
"ssn" VARCHAR(40),
"date_first_registered" DATETIME,
"date_left" DATETIME,
"other_student_details" VARCHAR(255),
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", "123 Maple St", "", "", "Springfield", "01101", "MA", "USA", "Near the park");
INSERT INTO "Addresses" VALUES ("2", "456 Oak Ave", "Apt 2B", "", "Shelbyville", "02202", "MA", "USA", "Opposite the mall");
INSERT INTO "Addresses" VALUES ("3", "789 Pine Rd", "", "Floor 3", "Capital City", "03303", "MA", "USA", "Next to the library");
INSERT INTO "Addresses" VALUES ("4", "321 Birch Blvd", "", "", "Ogdenville", "04404", "MA", "USA", "Close to the river");
INSERT INTO "Addresses" VALUES ("5", "654 Cedar Ln", "", "", "North Haverbrook", "05505", "MA", "USA", "Beside the school");
INSERT INTO "Addresses" VALUES ("6", "987 Elm St", "", "", "Springfield", "01101", "MA", "USA", "NULL");
INSERT INTO "Addresses" VALUES ("7", "159 Spruce Dr", "", "", "Shelbyville", "02202", "MA", "USA", "NULL");
INSERT INTO "Addresses" VALUES ("8", "753 Willow Way", "", "", "Capital City", "03303", "MA", "USA", "Near the stadium");
INSERT INTO "Addresses" VALUES ("9", "852 Aspen Ct", "", "", "Ogdenville", "04404", "MA", "USA", "NULL");
INSERT INTO "Addresses" VALUES ("10", "951 Fir Pl", "", "", "North Haverbrook", "05505", "MA", "USA", "Next to the post office");
INSERT INTO "Degree_Programs" VALUES ("1", "Computer Science");
INSERT INTO "Degree_Programs" VALUES ("2", "Mechanical 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 "Student_Enrolment" VALUES ("1", "1", "202101");
INSERT INTO "Student_Enrolment" VALUES ("2", "2", "202102");
INSERT INTO "Student_Enrolment" VALUES ("3", "3", "202103");
INSERT INTO "Student_Enrolment" VALUES ("4", "1", "202104");
INSERT INTO "Student_Enrolment" VALUES ("5", "4", "202101");
INSERT INTO "Student_Enrolment" VALUES ("6", "5", "202102");
INSERT INTO "Student_Enrolment" VALUES ("7", "2", "202103");
INSERT INTO "Student_Enrolment" VALUES ("8", "3", "202104");
INSERT INTO "Student_Enrolment" VALUES ("9", "4", "202101");
INSERT INTO "Student_Enrolment" VALUES ("10", "5", "202102");
INSERT INTO "Students" VALUES ("1", "1", "6", "Alice", "NULL", "Zimmerman", "555-1234", "alice.z@example.com", "123-45-6789", "2020-09-01", "NULL", "Prefers morning classes");
INSERT INTO "Students" VALUES ("2", "2", "7", "Bob", "J", "Young", "555-2345", "NULL", "987-65-4321", "2019-01-15", "2023-05-30", "Transferred to another university");
INSERT INTO "Students" VALUES ("3", "3", "8", "Charlie", "K", "Xavier", "NULL", "charlie.x@example.com", "111-22-3333", "2021-06-10", "NULL", "On scholarship");
INSERT INTO "Students" VALUES ("4", "4", "9", "Diana", "L", "White", "555-3456", "diana.w@example.com", "222-33-4444", "2018-08-20", "NULL", "Part-time student");
INSERT INTO "Students" VALUES ("5", "5", "10", "Evan", "NULL", "White", "555-4567", "evan.w@example.com", "333-44-5555", "2022-01-05", "NULL", "International student");
INSERT INTO "Students" VALUES ("6", "6", "1", "Fiona", "M", "Vance", "NULL", "NULL", "444-55-6666", "2020-02-28", "2022-12-15", "Graduated early");
INSERT INTO "Students" VALUES ("7", "7", "2", "George", "N", "Underwood", "555-5678", "george.u@example.com", "555-66-7777", "2017-09-12", "NULL", "Athlete");
INSERT INTO "Students" VALUES ("8", "8", "3", "Hannah", "NULL", "Taylor", "555-6789", "hannah.t@example.com", "666-77-8888", "2019-11-23", "NULL", "Exchange student");
INSERT INTO "Students" VALUES ("9", "9", "4", "Ian", "O", "Smith", "555-7890", "NULL", "777-88-9999", "2021-03-14", "NULL", "Needs special accommodations");
INSERT INTO "Students" VALUES ("10", "10", "5", "Jane", "P", "Smith", "555-8901", "jane.s@example.com", "888-99-0000", "2018-07-07", "2021-06-30", "Completed honors thesis");
INSERT INTO "Students" VALUES ("11", "1", "2", "Kyle", "NULL", "Roberts", "555-9012", "kyle.r@example.com", "999-00-1111", "2022-09-01", "NULL", "New enrollee");
INSERT INTO "Students" VALUES ("12", "3", "4", "Laura", "Q", "Quinn", "NULL", "laura.q@example.com", "000-11-2222", "2016-05-18", "NULL", "Part-time job");
INSERT INTO "Students" VALUES ("13", "5", "6", "Mike", "R", "Peters", "555-0123", "NULL", "111-22-3334", "2015-10-30", "2019-12-20", "Alumni");
INSERT INTO "Students" VALUES ("14", "7", "8", "Nina", "NULL", "Olsen", "555-1235", "nina.o@example.com", "222-33-4445", "2020-01-10", "NULL", "Volunteer work");
INSERT INTO "Students" VALUES ("15", "9", "10", "Oscar", "S", "Nelson", "NULL", "oscar.n@example.com", "333-44-5556", "2017-04-25", "NULL", "Dean's list");