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 "Students" (
"student_id" INT,
"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 1", "", "Springfield", "01101", "MA", "USA", "Near park");
INSERT INTO "Addresses" VALUES ("2", "456 Oak Ave", "", "", "Shelbyville", "02202", "MA", "USA", "");
INSERT INTO "Addresses" VALUES ("3", "789 Pine Rd", "Unit 5", "Building B", "Capital City", "03303", "MA", "USA", "Opposite mall");
INSERT INTO "Addresses" VALUES ("4", "321 Birch Blvd", "", "", "Ogdenville", "04404", "MA", "USA", "");
INSERT INTO "Addresses" VALUES ("5", "654 Cedar Ln", "Suite 10", "", "North Haverbrook", "05505", "MA", "USA", "Near lake");
INSERT INTO "Addresses" VALUES ("6", "987 Elm St", "", "", "Springfield", "01101", "MA", "USA", "Near park");
INSERT INTO "Addresses" VALUES ("7", "111 Spruce Dr", "", "", "Shelbyville", "02202", "MA", "USA", "");
INSERT INTO "Addresses" VALUES ("8", "222 Willow Way", "Apt 2", "", "Capital City", "03303", "MA", "USA", "Opposite mall");
INSERT INTO "Addresses" VALUES ("9", "333 Aspen Ct", "", "", "Ogdenville", "04404", "MA", "USA", "");
INSERT INTO "Addresses" VALUES ("10", "444 Fir St", "Unit 1", "Building A", "North Haverbrook", "05505", "MA", "USA", "Near lake");
INSERT INTO "Degree_Programs" VALUES ("1", "101");
INSERT INTO "Degree_Programs" VALUES ("2", "102");
INSERT INTO "Degree_Programs" VALUES ("3", "103");
INSERT INTO "Students" VALUES ("1001", "1", "2", "Alice");
INSERT INTO "Students" VALUES ("1002", "3", "4", "Bob");
INSERT INTO "Students" VALUES ("1003", "5", "6", "Charlie");
INSERT INTO "Students" VALUES ("1004", "1", "7", "Diana");
INSERT INTO "Students" VALUES ("1005", "8", "9", "Eve");
INSERT INTO "Students" VALUES ("1006", "10", "3", "Frank");
INSERT INTO "Students" VALUES ("1007", "2", "1", "Grace");
INSERT INTO "Students" VALUES ("1008", "3", "5", "Hank");
INSERT INTO "Students" VALUES ("1009", "7", "8", "Ivy");
INSERT INTO "Students" VALUES ("1010", "10", "4", "Jack");