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 "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),
"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", "NULL");
INSERT INTO "Addresses" VALUES ("2", "456 Oak Ave", "Apt 10B", "NULL", "Otherville", "67890", "NY", "USA", "Near park");
INSERT INTO "Addresses" VALUES ("3", "789 Pine Ln", "NULL", "NULL", "Smalltown", "11223", "TX", "USA", "NULL");
INSERT INTO "Addresses" VALUES ("4", "101 Elm Rd", "Unit 5", "NULL", "Big City", "98765", "FL", "USA", "Gated community");
INSERT INTO "Addresses" VALUES ("5", "222 Maple Dr", "NULL", "NULL", "Anytown", "12345", "CA", "USA", "NULL");
INSERT INTO "Addresses" VALUES ("6", "333 Birch Ct", "NULL", "NULL", "Otherville", "67890", "NY", "USA", "NULL");
INSERT INTO "Addresses" VALUES ("7", "444 Cedar Blvd", "NULL", "NULL", "Smalltown", "11223", "TX", "USA", "Corner house");
INSERT INTO "Addresses" VALUES ("8", "555 Willow Way", "NULL", "NULL", "Big City", "98765", "FL", "USA", "NULL");
INSERT INTO "Addresses" VALUES ("9", "666 Poplar Pl", "NULL", "NULL", "Anytown", "12345", "CA", "USA", "Student housing");
INSERT INTO "Addresses" VALUES ("10", "777 Spruce St", "NULL", "NULL", "Otherville", "67890", "NY", "USA", "NULL");
INSERT INTO "Student_Enrolment" VALUES ("1", "101");
INSERT INTO "Student_Enrolment" VALUES ("2", "102");
INSERT INTO "Student_Enrolment" VALUES ("3", "101");
INSERT INTO "Student_Enrolment" VALUES ("4", "103");
INSERT INTO "Student_Enrolment" VALUES ("5", "102");
INSERT INTO "Student_Enrolment" VALUES ("6", "101");
INSERT INTO "Student_Enrolment" VALUES ("7", "104");
INSERT INTO "Student_Enrolment" VALUES ("8", "103");
INSERT INTO "Student_Enrolment" VALUES ("9", "101");
INSERT INTO "Student_Enrolment" VALUES ("10", "102");
INSERT INTO "Students" VALUES ("1", "1", "1", "Alice", "Smith");
INSERT INTO "Students" VALUES ("2", "2", "2", "Bob", "Johnson");
INSERT INTO "Students" VALUES ("3", "3", "1", "Charlie", "Brown");
INSERT INTO "Students" VALUES ("4", "4", "4", "Diana", "Miller");
INSERT INTO "Students" VALUES ("5", "5", "1", "Eve", "Davis");
INSERT INTO "Students" VALUES ("6", "6", "2", "Frank", "Garcia");
INSERT INTO "Students" VALUES ("7", "7", "7", "Grace", "Rodriguez");
INSERT INTO "Students" VALUES ("8", "8", "4", "Henry", "Martinez");
INSERT INTO "Students" VALUES ("9", "9", "1", "Ivy", "Hernandez");
INSERT INTO "Students" VALUES ("10", "10", "2", "Jack", "Lopez");
INSERT INTO "Students" VALUES ("11", "1", "1", "Karen", "Gonzalez");
INSERT INTO "Students" VALUES ("12", "2", "2", "Liam", "Wilson");
INSERT INTO "Students" VALUES ("13", "3", "3", "Mia", "Anderson");
INSERT INTO "Students" VALUES ("14", "4", "4", "Noah", "Thomas");
INSERT INTO "Students" VALUES ("15", "5", "5", "Olivia", "Jackson");
INSERT INTO "Students" VALUES ("16", "1", "1", "Peter", "White");
INSERT INTO "Students" VALUES ("17", "2", "2", "Quinn", "Harris");
INSERT INTO "Students" VALUES ("18", "3", "3", "Rachel", "Clark");
INSERT INTO "Students" VALUES ("19", "4", "4", "Sam", "Lewis");
INSERT INTO "Students" VALUES ("20", "5", "5", "Tina", "Young");