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),
PRIMARY KEY ("address_id")
);

CREATE TABLE "Student_Enrolment" (
"student_enrolment_id" INT,
"degree_program_id" INT,
PRIMARY KEY ("student_enrolment_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),
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");
INSERT INTO "Addresses" VALUES ("2", "456 Oak Ave", "NULL", "NULL", "Otherville", "67890", "NY", "USA");
INSERT INTO "Addresses" VALUES ("3", "789 Pine Ln", "NULL", "NULL", "Anytown", "12345", "CA", "USA");
INSERT INTO "Addresses" VALUES ("4", "101 Elm Rd", "NULL", "NULL", "Smallville", "11223", "TX", "USA");
INSERT INTO "Addresses" VALUES ("5", "202 Birch Blvd", "NULL", "NULL", "Big City", "98765", "FL", "USA");
INSERT INTO "Addresses" VALUES ("6", "303 Cedar Ct", "NULL", "NULL", "Otherville", "67890", "NY", "USA");
INSERT INTO "Addresses" VALUES ("7", "404 Maple Dr", "NULL", "NULL", "Anytown", "12345", "CA", "USA");
INSERT INTO "Addresses" VALUES ("8", "505 Willow Way", "NULL", "NULL", "Smallville", "11223", "TX", "USA");
INSERT INTO "Addresses" VALUES ("9", "606 Poplar Pl", "NULL", "NULL", "Big City", "98765", "FL", "USA");
INSERT INTO "Addresses" VALUES ("10", "707 Spruce Sq", "NULL", "NULL", "Anytown", "12345", "CA", "USA");
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", "2");
INSERT INTO "Student_Enrolment" VALUES ("106", "1");
INSERT INTO "Student_Enrolment" VALUES ("107", "3");
INSERT INTO "Student_Enrolment" VALUES ("108", "2");
INSERT INTO "Student_Enrolment" VALUES ("109", "1");
INSERT INTO "Student_Enrolment" VALUES ("110", "3");
INSERT INTO "Students" VALUES ("101", "1", "1", "Alice", "NULL", "Smith");
INSERT INTO "Students" VALUES ("102", "2", "3", "Bob", "NULL", "Johnson");
INSERT INTO "Students" VALUES ("103", "3", "2", "Charlie", "NULL", "Brown");
INSERT INTO "Students" VALUES ("104", "4", "4", "Diana", "NULL", "Miller");
INSERT INTO "Students" VALUES ("105", "5", "6", "Eve", "NULL", "Davis");
INSERT INTO "Students" VALUES ("106", "7", "7", "Frank", "NULL", "Garcia");
INSERT INTO "Students" VALUES ("107", "8", "9", "Grace", "NULL", "Rodriguez");
INSERT INTO "Students" VALUES ("108", "10", "5", "Henry", "NULL", "Martinez");
INSERT INTO "Students" VALUES ("109", "1", "2", "Ivy", "NULL", "Hernandez");
INSERT INTO "Students" VALUES ("110", "4", "1", "Jack", "NULL", "Lopez");