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 "Departments" (
"department_id" INT,
"department_name" VARCHAR(255),
PRIMARY KEY ("department_id")
);

CREATE TABLE "Student_Enrolment" (
"student_enrolment_id" INT,
"degree_program_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 Main St", "NULL", "NULL", "Anytown", "12345", "CA", "USA", "Apt 1A");
INSERT INTO "Addresses" VALUES ("2", "456 Oak Ave", "NULL", "NULL", "Otherville", "67890", "NY", "USA", "Unit B");
INSERT INTO "Addresses" VALUES ("3", "789 Pine Ln", "NULL", "NULL", "Smallville", "11223", "TX", "USA", "House with garden");
INSERT INTO "Addresses" VALUES ("4", "101 Elm Rd", "NULL", "NULL", "Big City", "98765", "FL", "USA", "Penthouse");
INSERT INTO "Addresses" VALUES ("5", "222 Maple Dr", "NULL", "NULL", "Suburbia", "54321", "WA", "USA", "Basement apartment");
INSERT INTO "Addresses" VALUES ("6", "333 Birch Blvd", "NULL", "NULL", "Rural Area", "00000", "GA", "USA", "Farmhouse");
INSERT INTO "Addresses" VALUES ("7", "444 Cedar Ct", "NULL", "NULL", "Coastal Town", "13579", "OR", "USA", "Beachfront property");
INSERT INTO "Addresses" VALUES ("8", "555 Spruce St", "NULL", "NULL", "Mountain City", "24680", "CO", "USA", "Cabin in the woods");
INSERT INTO "Addresses" VALUES ("9", "666 Willow Way", "NULL", "NULL", "Desert Oasis", "97531", "AZ", "USA", "Ranch style home");
INSERT INTO "Addresses" VALUES ("10", "777 Poplar Pl", "NULL", "NULL", "Valley View", "86420", "VA", "USA", "Townhouse");
INSERT INTO "Degree_Programs" VALUES ("1", "Bachelor of Science in Computer Science");
INSERT INTO "Degree_Programs" VALUES ("2", "Master of Arts in English Literature");
INSERT INTO "Degree_Programs" VALUES ("3", "PhD in Physics");
INSERT INTO "Degree_Programs" VALUES ("4", "Associate of Arts");
INSERT INTO "Degree_Programs" VALUES ("5", "Bachelor of Business Administration");
INSERT INTO "Departments" VALUES ("1", "Computer Science");
INSERT INTO "Departments" VALUES ("2", "English");
INSERT INTO "Departments" VALUES ("3", "Physics");
INSERT INTO "Departments" VALUES ("4", "Liberal Arts");
INSERT INTO "Departments" VALUES ("5", "Business");
INSERT INTO "Student_Enrolment" VALUES ("101", "1");
INSERT INTO "Student_Enrolment" VALUES ("102", "2");
INSERT INTO "Student_Enrolment" VALUES ("103", "3");
INSERT INTO "Student_Enrolment" VALUES ("104", "1");
INSERT INTO "Student_Enrolment" VALUES ("105", "4");
INSERT INTO "Student_Enrolment" VALUES ("106", "5");
INSERT INTO "Student_Enrolment" VALUES ("107", "1");
INSERT INTO "Student_Enrolment" VALUES ("108", "2");
INSERT INTO "Student_Enrolment" VALUES ("109", "3");
INSERT INTO "Student_Enrolment" VALUES ("110", "5");
INSERT INTO "Students" VALUES ("1", "1", "1", "Alice", "M.", "Smith", "555-111-2222", "alice.smith@example.com", "123-45-6789", "2020-09-01 09:00:00", "NULL", "Transferred from Community College");
INSERT INTO "Students" VALUES ("2", "2", "2", "Bob", "A.", "Johnson", "555-333-4444", "bob.j@example.com", "987-65-4321", "2019-09-01 09:00:00", "NULL", "Deans List student");
INSERT INTO "Students" VALUES ("3", "3", "3", "Charlie", "P.", "Brown", "555-555-6666", "charlie.b@example.com", "111-22-3333", "2021-01-15 09:00:00", "NULL", "Received scholarship");
INSERT INTO "Students" VALUES ("4", "4", "4", "Diana", "L.", "Miller", "555-777-8888", "diana.m@example.com", "444-55-6666", "2020-09-01 09:00:00", "2022-05-15 17:00:00", "Withdrew due to health reasons");
INSERT INTO "Students" VALUES ("5", "5", "5", "Eve", "R.", "Davis", "555-999-0000", "eve.d@example.com", "777-88-9999", "2021-09-01 09:00:00", "NULL", "Part-time student");
INSERT INTO "Students" VALUES ("6", "6", "6", "Frank", "J.", "Garcia", "555-123-4567", "frank.g@example.com", "222-33-4444", "2018-09-01 09:00:00", "NULL", "Graduate assistant");
INSERT INTO "Students" VALUES ("7", "7", "7", "Grace", "K.", "Rodriguez", "555-987-6543", "grace.r@example.com", "555-66-7777", "2022-01-10 09:00:00", "NULL", "International student");
INSERT INTO "Students" VALUES ("8", "8", "8", "Henry", "S.", "Martinez", "555-654-3210", "henry.m@example.com", "888-99-0000", "2019-09-01 09:00:00", "NULL", "Veteran student");
INSERT INTO "Students" VALUES ("9", "9", "9", "Ivy", "T.", "Hernandez", "555-321-0987", "ivy.h@example.com", "333-44-5555", "2020-01-20 09:00:00", "NULL", "Student athlete");
INSERT INTO "Students" VALUES ("10", "10", "10", "Jack", "W.", "Lopez", "555-000-1111", "jack.l@example.com", "666-77-8888", "2021-09-01 09:00:00", "NULL", "First-generation student");
INSERT INTO "Students" VALUES ("11", "1", "1", "Zoe", "X.", "Young", "555-222-3333", "zoe.y@example.com", "100-20-3000", "2020-09-01 09:00:00", "NULL", "Active in student government");
INSERT INTO "Students" VALUES ("12", "2", "2", "Yara", "V.", "Xavier", "555-444-5555", "yara.x@example.com", "400-50-6000", "2019-09-01 09:00:00", "NULL", "Excellent academic record");
INSERT INTO "Students" VALUES ("13", "3", "3", "William", "U.", "White", "555-666-7777", "william.w@example.com", "700-80-9000", "2021-01-15 09:00:00", "NULL", "Transfer student");
INSERT INTO "Students" VALUES ("14", "4", "4", "Victor", "Q.", "Vance", "555-888-9999", "victor.v@example.com", "000-10-2000", "2020-09-01 09:00:00", "NULL", "Graduated with honors");
INSERT INTO "Students" VALUES ("15", "5", "5", "Uma", "N.", "Upton", "555-000-2222", "uma.u@example.com", "300-40-5000", "2021-09-01 09:00:00", "NULL", "Currently on leave of absence");