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,
"department_id" INT,
PRIMARY KEY ("degree_program_id")
);

CREATE TABLE "Student_Enrolment" (
"student_enrolment_id" INT,
"semester_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),
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", "Apt 4B", "", "Springfield", "01101", "Hampden County", "USA", "Near the park");
INSERT INTO "Addresses" VALUES ("2", "456 Oak Ave", "", "", "Shelbyville", "02202", "Shelby County", "USA", "");
INSERT INTO "Addresses" VALUES ("3", "789 Pine Rd", "Unit 12", "Building 5", "Capital City", "03303", "Capital District", "USA", "Opposite the mall");
INSERT INTO "Addresses" VALUES ("4", "321 Birch Blvd", "", "Floor 3", "Ogdenville", "04404", "Ogden County", "USA", "Next to the library");
INSERT INTO "Addresses" VALUES ("5", "654 Cedar Ln", "", "", "North Haverbrook", "05505", "Haverbrook County", "USA", "");
INSERT INTO "Addresses" VALUES ("6", "987 Elm St", "Suite 100", "", "Springfield", "01101", "Hampden County", "USA", "Corner of 5th and Elm");
INSERT INTO "Addresses" VALUES ("7", "159 Spruce Dr", "", "", "Shelbyville", "02202", "Shelby County", "USA", "Near the river");
INSERT INTO "Addresses" VALUES ("8", "753 Willow Way", "Apt 9", "Building 2", "Capital City", "03303", "Capital District", "USA", "Close to university");
INSERT INTO "Addresses" VALUES ("9", "852 Aspen Ct", "", "", "Ogdenville", "04404", "Ogden County", "USA", "");
INSERT INTO "Addresses" VALUES ("10", "951 Poplar St", "", "", "North Haverbrook", "05505", "Haverbrook County", "USA", "Opposite the post office");
INSERT INTO "Students" VALUES ("101", "1", "2", "Alice");
INSERT INTO "Students" VALUES ("102", "3", "3", "Bob");
INSERT INTO "Students" VALUES ("103", "4", "5", "Charlie");
INSERT INTO "Students" VALUES ("104", "6", "1", "Diana");
INSERT INTO "Students" VALUES ("105", "7", "8", "Ethan");
INSERT INTO "Students" VALUES ("106", "9", "10", "Fiona");
INSERT INTO "Students" VALUES ("107", "2", "7", "George");
INSERT INTO "Students" VALUES ("108", "5", "4", "Hannah");
INSERT INTO "Students" VALUES ("109", "8", "6", "Ian");
INSERT INTO "Students" VALUES ("110", "10", "9", "Jane");