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 "Students" (
"student_id" INT,
"current_address_id" INT,
"permanent_address_id" INT,
"first_name" VARCHAR(80),
"email_address" 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 Maple St", "Apt 4", "", "Springfield", "01101", "MA", "USA", "");
INSERT INTO "Addresses" VALUES ("2", "456 Oak St", "", "", "Springfield", "01102", "MA", "USA", "");
INSERT INTO "Addresses" VALUES ("3", "789 Pine St", "Suite 5", "", "Shelbyville", "02101", "MA", "USA", "");
INSERT INTO "Addresses" VALUES ("4", "101 Elm St", "", "Building B", "Capital City", "03101", "MA", "USA", "");
INSERT INTO "Addresses" VALUES ("5", "202 Birch St", "", "", "Springfield", "01101", "MA", "USA", "Near park");
INSERT INTO "Addresses" VALUES ("6", "303 Cedar St", "Floor 2", "", "Shelbyville", "02102", "MA", "USA", "");
INSERT INTO "Addresses" VALUES ("7", "404 Walnut St", "", "", "Capital City", "03102", "MA", "USA", "");
INSERT INTO "Addresses" VALUES ("8", "505 Chestnut St", "Apt 1", "", "Springfield", "01103", "MA", "USA", "Opposite school");
INSERT INTO "Students" VALUES ("1001", "1", "2", "Alice", "alice@example.com");
INSERT INTO "Students" VALUES ("1002", "3", "3", "Bob", "bob@example.com");
INSERT INTO "Students" VALUES ("1003", "4", "5", "Charlie", "charlie@example.com");
INSERT INTO "Students" VALUES ("1004", "6", "6", "Diana", "diana@example.com");
INSERT INTO "Students" VALUES ("1005", "7", "8", "Eve", "eve@example.com");
INSERT INTO "Students" VALUES ("1006", "1", "1", "Frank", "frank@example.com");