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 "Students" (
"student_id" INT,
"current_address_id" INT,
"permanent_address_id" INT,
"first_name" VARCHAR(80),
"cell_mobile_number" VARCHAR(40),
"email_address" VARCHAR(40),
"date_first_registered" DATETIME,
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", "MA", "USA", "Near the park");
INSERT INTO "Addresses" VALUES ("2", "456 Oak Ave", "", "", "Shelbyville", "02202", "MA", "USA", "");
INSERT INTO "Addresses" VALUES ("3", "789 Pine Rd", "Suite 12", "", "Capital City", "03303", "MA", "USA", "Opposite the mall");
INSERT INTO "Addresses" VALUES ("4", "321 Birch Blvd", "", "Building 5", "Ogdenville", "04404", "MA", "USA", "Next to the library");
INSERT INTO "Addresses" VALUES ("5", "654 Cedar Ln", "", "", "North Haverbrook", "05505", "MA", "USA", "");
INSERT INTO "Students" VALUES ("101", "1", "2", "Alice", "555-1234", "alice@example.com", "2020-09-01 08:30:00");
INSERT INTO "Students" VALUES ("102", "3", "3", "Bob", "555-5678", "bob@example.com", "2019-01-15 09:00:00");
INSERT INTO "Students" VALUES ("103", "4", "5", "Charlie", "555-8765", "charlie@example.com", "2021-06-20 10:15:00");
INSERT INTO "Students" VALUES ("104", "2", "2", "Diana", "555-4321", "diana@example.com", "2018-11-11 11:45:00");
INSERT INTO "Students" VALUES ("105", "5", "1", "Eve", "555-0000", "eve@example.com", "2022-02-02 12:00:00");