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),
"city" VARCHAR(255),
"zip_postcode" VARCHAR(20),
PRIMARY KEY ("address_id")
);

CREATE TABLE "Students" (
"student_id" INT,
"current_address_id" INT,
"permanent_address_id" INT,
"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 1", "Springfield", "01101");
INSERT INTO "Addresses" VALUES ("2", "456 Oak St", "", "Springfield", "01102");
INSERT INTO "Addresses" VALUES ("3", "789 Pine St", "Suite 5", "Shelbyville", "02201");
INSERT INTO "Addresses" VALUES ("4", "101 Elm St", "Floor 2", "Springfield", "01103");
INSERT INTO "Addresses" VALUES ("5", "202 Birch St", "", "Ogdenville", "03301");
INSERT INTO "Students" VALUES ("1", "1", "2", "student1@example.com");
INSERT INTO "Students" VALUES ("2", "1", "3", "student2@example.com");
INSERT INTO "Students" VALUES ("3", "1", "4", "student3@example.com");
INSERT INTO "Students" VALUES ("4", "2", "1", "student4@example.com");
INSERT INTO "Students" VALUES ("5", "2", "5", "student5@example.com");
INSERT INTO "Students" VALUES ("6", "3", "1", "student6@example.com");
INSERT INTO "Students" VALUES ("7", "1", "5", "student7@example.com");
INSERT INTO "Students" VALUES ("8", "4", "2", "student8@example.com");
INSERT INTO "Students" VALUES ("9", "1", "3", "student9@example.com");
INSERT INTO "Students" VALUES ("10", "5", "4", "student10@example.com");