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),
"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 101", "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 B", "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", "Suite 200", "NULL", "Smalltown", "11223", "TX", "USA", "Office building");
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", "NULL");
INSERT INTO "Addresses" VALUES ("10", "777 Spruce St", "Floor 3", "NULL", "Otherville", "67890", "NY", "USA", "NULL");
INSERT INTO "Students" VALUES ("1", "1", "1", "Alice", "Smith");
INSERT INTO "Students" VALUES ("2", "1", "2", "Bob", "Johnson");
INSERT INTO "Students" VALUES ("3", "2", "3", "Charlie", "Brown");
INSERT INTO "Students" VALUES ("4", "3", "4", "Diana", "Prince");
INSERT INTO "Students" VALUES ("5", "1", "5", "Eve", "Adams");
INSERT INTO "Students" VALUES ("6", "4", "6", "Frank", "White");
INSERT INTO "Students" VALUES ("7", "2", "7", "Grace", "Lee");
INSERT INTO "Students" VALUES ("8", "1", "8", "Henry", "King");
INSERT INTO "Students" VALUES ("9", "5", "9", "Ivy", "Chen");
INSERT INTO "Students" VALUES ("10", "6", "10", "Jack", "Davis");
INSERT INTO "Students" VALUES ("11", "1", "1", "Karen", "Miller");
INSERT INTO "Students" VALUES ("12", "2", "2", "Liam", "Wilson");
INSERT INTO "Students" VALUES ("13", "1", "3", "Mia", "Taylor");
INSERT INTO "Students" VALUES ("14", "3", "4", "Noah", "Moore");
INSERT INTO "Students" VALUES ("15", "1", "5", "Olivia", "Hall");
INSERT INTO "Students" VALUES ("16", "4", "6", "Peter", "Clark");
INSERT INTO "Students" VALUES ("17", "2", "7", "Quinn", "Lewis");
INSERT INTO "Students" VALUES ("18", "1", "8", "Rachel", "Young");
INSERT INTO "Students" VALUES ("19", "5", "9", "Sam", "Wright");
INSERT INTO "Students" VALUES ("20", "6", "10", "Tina", "Green");