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", "Apt 4B", "NULL", "Anytown", "12345", "CA", "USA", "NULL");
INSERT INTO "Addresses" VALUES ("2", "456 Oak Ave", "NULL", "NULL", "Otherville", "67890", "NY", "USA", "NULL");
INSERT INTO "Addresses" VALUES ("3", "789 Pine Ln", "Suite 100", "NULL", "Smallville", "11223", "TX", "USA", "NULL");
INSERT INTO "Addresses" VALUES ("4", "101 Elm Rd", "NULL", "NULL", "Big City", "98765", "FL", "USA", "NULL");
INSERT INTO "Addresses" VALUES ("5", "222 Maple Dr", "NULL", "NULL", "Metropolis", "54321", "IL", "USA", "NULL");
INSERT INTO "Addresses" VALUES ("6", "333 Birch Blvd", "NULL", "NULL", "Suburbia", "09876", "GA", "USA", "NULL");
INSERT INTO "Addresses" VALUES ("7", "444 Cedar Ct", "NULL", "NULL", "Rural Area", "23456", "WA", "USA", "NULL");
INSERT INTO "Addresses" VALUES ("8", "555 Spruce St", "NULL", "NULL", "Coastal Town", "78901", "OR", "USA", "NULL");
INSERT INTO "Addresses" VALUES ("9", "666 Willow Way", "NULL", "NULL", "Mountain City", "34567", "CO", "USA", "NULL");
INSERT INTO "Addresses" VALUES ("10", "777 Poplar Pkwy", "NULL", "NULL", "Desert Oasis", "89012", "AZ", "USA", "NULL");
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", "Mathematics");
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", "1");
INSERT INTO "Student_Enrolment" VALUES ("104", "3");
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 ("1001", "1", "1", "Alice", "M.", "Smith", "555-123-4567", "alice.smith@example.com", "111-22-3333", "2020-09-01 00:00:00", "NULL", "NULL");
INSERT INTO "Students" VALUES ("1002", "2", "2", "Bob", "A.", "Johnson", "555-987-6543", "bob.j@example.com", "222-33-4444", "2019-01-15 00:00:00", "NULL", "NULL");
INSERT INTO "Students" VALUES ("1003", "3", "3", "Charlie", "D.", "Brown", "555-111-2222", "charlie.b@example.com", "333-44-5555", "2021-03-10 00:00:00", "NULL", "NULL");
INSERT INTO "Students" VALUES ("1004", "4", "4", "Diana", "L.", "Prince", "555-333-4444", "diana.p@example.com", "444-55-6666", "2018-08-20 00:00:00", "2022-05-15 00:00:00", "Transferred out");
INSERT INTO "Students" VALUES ("1005", "5", "5", "Eve", "K.", "Davis", "555-555-6666", "eve.d@example.com", "555-66-7777", "2022-02-01 00:00:00", "NULL", "NULL");
INSERT INTO "Students" VALUES ("1006", "6", "6", "Frank", "J.", "Miller", "555-777-8888", "frank.m@example.com", "666-77-8888", "2020-11-01 00:00:00", "NULL", "NULL");
INSERT INTO "Students" VALUES ("1007", "7", "7", "Grace", "P.", "Wilson", "555-222-3333", "grace.w@example.com", "777-88-9999", "2019-05-01 00:00:00", "NULL", "NULL");
INSERT INTO "Students" VALUES ("1008", "8", "8", "Henry", "R.", "Moore", "555-444-5555", "henry.m@example.com", "888-99-0000", "2021-01-01 00:00:00", "NULL", "NULL");
INSERT INTO "Students" VALUES ("1009", "9", "9", "Ivy", "S.", "Taylor", "555-666-7777", "ivy.t@example.com", "999-00-1111", "2018-03-01 00:00:00", "2020-12-31 00:00:00", "Graduated");
INSERT INTO "Students" VALUES ("1010", "10", "10", "Jack", "T.", "White", "555-888-9999", "jack.w@example.com", "000-11-2222", "2022-09-01 00:00:00", "NULL", "NULL");