{"Ref_Feature_Types": {"columns": [[0, "feature_type_code", "VARCHAR(20)", 0, null, 1], [1, "feature_type_name", "VARCHAR(80)", 0, null, 0]], "primary_keys": ["feature_type_code"], "foreign_keys": [], "unique_constraints": [[[0, 0, "feature_type_code"]]], "check_constraints": []}, "Ref_Property_Types": {"columns": [[0, "property_type_code", "VARCHAR(20)", 0, null, 1], [1, "property_type_description", "VARCHAR(80)", 0, null, 0]], "primary_keys": ["property_type_code"], "foreign_keys": [], "unique_constraints": [[[0, 0, "property_type_code"]]], "check_constraints": []}, "Other_Available_Features": {"columns": [[0, "feature_id", "INTEGER", 0, null, 1], [1, "feature_type_code", "VARCHAR(20)", 1, null, 0], [2, "feature_name", "VARCHAR(80)", 0, null, 0], [3, "feature_description", "VARCHAR(80)", 0, null, 0]], "primary_keys": ["feature_id"], "foreign_keys": [[0, 0, "Ref_Feature_Types", "feature_type_code", "feature_type_code", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Properties": {"columns": [[0, "property_id", "INTEGER", 0, null, 1], [1, "property_type_code", "VARCHAR(20)", 1, null, 0], [2, "date_on_market", "DATETIME", 0, null, 0], [3, "date_sold", "DATETIME", 0, null, 0], [4, "property_name", "VARCHAR(80)", 0, null, 0], [5, "property_address", "VARCHAR(255)", 0, null, 0], [6, "room_count", "INTEGER", 0, null, 0], [7, "vendor_requested_price", "DECIMAL(19,4)", 0, null, 0], [8, "buyer_offered_price", "DECIMAL(19,4)", 0, null, 0], [9, "agreed_selling_price", "DECIMAL(19,4)", 0, null, 0], [10, "apt_feature_1", "VARCHAR(255)", 0, null, 0], [11, "apt_feature_2", "VARCHAR(255)", 0, null, 0], [12, "apt_feature_3", "VARCHAR(255)", 0, null, 0], [13, "fld_feature_1", "VARCHAR(255)", 0, null, 0], [14, "fld_feature_2", "VARCHAR(255)", 0, null, 0], [15, "fld_feature_3", "VARCHAR(255)", 0, null, 0], [16, "hse_feature_1", "VARCHAR(255)", 0, null, 0], [17, "hse_feature_2", "VARCHAR(255)", 0, null, 0], [18, "hse_feature_3", "VARCHAR(255)", 0, null, 0], [19, "oth_feature_1", "VARCHAR(255)", 0, null, 0], [20, "oth_feature_2", "VARCHAR(255)", 0, null, 0], [21, "oth_feature_3", "VARCHAR(255)", 0, null, 0], [22, "shp_feature_1", "VARCHAR(255)", 0, null, 0], [23, "shp_feature_2", "VARCHAR(255)", 0, null, 0], [24, "shp_feature_3", "VARCHAR(255)", 0, null, 0], [25, "other_property_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["property_id"], "foreign_keys": [[0, 0, "Ref_Property_Types", "property_type_code", "property_type_code", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Other_Property_Features": {"columns": [[0, "property_id", "INTEGER", 1, null, 0], [1, "feature_id", "INTEGER", 1, null, 0], [2, "property_feature_description", "VARCHAR(80)", 0, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "Properties", "property_id", "property_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Other_Available_Features", "feature_id", "feature_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}}
CREATE TABLE Ref_Feature_Types (
    feature_type_code VARCHAR(20)   PRIMARY KEY,
    feature_type_name VARCHAR(80),
    UNIQUE (feature_type_code)
);

CREATE TABLE Ref_Property_Types (
    property_type_code VARCHAR(20)   PRIMARY KEY,
    property_type_description VARCHAR(80),
    UNIQUE (property_type_code)
);

CREATE TABLE Other_Available_Features (
    feature_id INTEGER   PRIMARY KEY,
    feature_type_code VARCHAR(20) NOT NULL,
    feature_name VARCHAR(80),
    feature_description VARCHAR(80),
    FOREIGN KEY (feature_type_code) REFERENCES Ref_Feature_Types(feature_type_code)
);

CREATE TABLE Properties (
    property_id INTEGER   PRIMARY KEY,
    property_type_code VARCHAR(20) NOT NULL,
    date_on_market DATETIME,
    date_sold DATETIME,
    property_name VARCHAR(80),
    property_address VARCHAR(255),
    room_count INTEGER,
    vendor_requested_price DECIMAL(19,4),
    buyer_offered_price DECIMAL(19,4),
    agreed_selling_price DECIMAL(19,4),
    apt_feature_1 VARCHAR(255),
    apt_feature_2 VARCHAR(255),
    apt_feature_3 VARCHAR(255),
    fld_feature_1 VARCHAR(255),
    fld_feature_2 VARCHAR(255),
    fld_feature_3 VARCHAR(255),
    hse_feature_1 VARCHAR(255),
    hse_feature_2 VARCHAR(255),
    hse_feature_3 VARCHAR(255),
    oth_feature_1 VARCHAR(255),
    oth_feature_2 VARCHAR(255),
    oth_feature_3 VARCHAR(255),
    shp_feature_1 VARCHAR(255),
    shp_feature_2 VARCHAR(255),
    shp_feature_3 VARCHAR(255),
    other_property_details VARCHAR(255),
    FOREIGN KEY (property_type_code) REFERENCES Ref_Property_Types(property_type_code)
);

CREATE TABLE Other_Property_Features (
    property_id INTEGER NOT NULL,
    feature_id INTEGER NOT NULL,
    property_feature_description VARCHAR(80),
    FOREIGN KEY (property_id) REFERENCES Properties(property_id),
    FOREIGN KEY (feature_id) REFERENCES Other_Available_Features(feature_id)
);