{"Student": {"columns": [[0, "StuID", "INTEGER", 0, null, 1], [1, "LName", "VARCHAR(12)", 0, null, 0], [2, "Fname", "VARCHAR(12)", 0, null, 0], [3, "Age", "INTEGER", 0, null, 0], [4, "Sex", "VARCHAR(1)", 0, null, 0], [5, "Major", "INTEGER", 0, null, 0], [6, "Advisor", "INTEGER", 0, null, 0], [7, "city_code", "VARCHAR(3)", 0, null, 0]], "primary_keys": ["StuID"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Dorm": {"columns": [[0, "dormid", "INTEGER", 0, null, 0], [1, "dorm_name", "VARCHAR(20)", 0, null, 0], [2, "student_capacity", "INTEGER", 0, null, 0], [3, "gender", "VARCHAR(1)", 0, null, 0]], "primary_keys": [], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Dorm_amenity": {"columns": [[0, "amenid", "INTEGER", 0, null, 0], [1, "amenity_name", "VARCHAR(25)", 0, null, 0]], "primary_keys": [], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Has_amenity": {"columns": [[0, "dormid", "INTEGER", 0, null, 0], [1, "amenid", "INTEGER", 0, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "Dorm_amenity", "amenid", "amenid", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Dorm", "dormid", "dormid", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Lives_in": {"columns": [[0, "stuid", "INTEGER", 0, null, 0], [1, "dormid", "INTEGER", 0, null, 0], [2, "room_number", "INTEGER", 0, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "Dorm", "dormid", "dormid", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Student", "stuid", "StuID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}}
CREATE TABLE Student (
    StuID INTEGER   PRIMARY KEY,
    LName VARCHAR(12),
    Fname VARCHAR(12),
    Age INTEGER,
    Sex VARCHAR(1),
    Major INTEGER,
    Advisor INTEGER,
    city_code VARCHAR(3)
);

CREATE TABLE Dorm (
    dormid INTEGER,
    dorm_name VARCHAR(20),
    student_capacity INTEGER,
    gender VARCHAR(1)
);

CREATE TABLE Dorm_amenity (
    amenid INTEGER,
    amenity_name VARCHAR(25)
);

CREATE TABLE Has_amenity (
    dormid INTEGER,
    amenid INTEGER,
    FOREIGN KEY (amenid) REFERENCES Dorm_amenity(amenid),
    FOREIGN KEY (dormid) REFERENCES Dorm(dormid)
);

CREATE TABLE Lives_in (
    stuid INTEGER,
    dormid INTEGER,
    room_number INTEGER,
    FOREIGN KEY (dormid) REFERENCES Dorm(dormid),
    FOREIGN KEY (stuid) REFERENCES Student(StuID)
);