{"Ref_Characteristic_Types": {"columns": [[0, "characteristic_type_code", "VARCHAR(15)", 0, null, 1], [1, "characteristic_type_description", "VARCHAR(80)", 0, null, 0]], "primary_keys": ["characteristic_type_code"], "foreign_keys": [], "unique_constraints": [[[0, 0, "characteristic_type_code"]]], "check_constraints": []}, "Ref_Colors": {"columns": [[0, "color_code", "VARCHAR(15)", 0, null, 1], [1, "color_description", "VARCHAR(80)", 0, null, 0]], "primary_keys": ["color_code"], "foreign_keys": [], "unique_constraints": [[[0, 0, "color_code"]]], "check_constraints": []}, "Ref_Product_Categories": {"columns": [[0, "product_category_code", "VARCHAR(15)", 0, null, 1], [1, "product_category_description", "VARCHAR(80)", 0, null, 0], [2, "unit_of_measure", "VARCHAR(20)", 0, null, 0]], "primary_keys": ["product_category_code"], "foreign_keys": [], "unique_constraints": [[[0, 0, "product_category_code"]]], "check_constraints": []}, "Characteristics": {"columns": [[0, "characteristic_id", "INTEGER", 0, null, 1], [1, "characteristic_type_code", "VARCHAR(15)", 1, null, 0], [2, "characteristic_data_type", "VARCHAR(10)", 0, null, 0], [3, "characteristic_name", "VARCHAR(80)", 0, null, 0], [4, "other_characteristic_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["characteristic_id"], "foreign_keys": [[0, 0, "Ref_Characteristic_Types", "characteristic_type_code", "characteristic_type_code", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Products": {"columns": [[0, "product_id", "INTEGER", 0, null, 1], [1, "color_code", "VARCHAR(15)", 1, null, 0], [2, "product_category_code", "VARCHAR(15)", 1, null, 0], [3, "product_name", "VARCHAR(80)", 0, null, 0], [4, "typical_buying_price", "VARCHAR(20)", 0, null, 0], [5, "typical_selling_price", "VARCHAR(20)", 0, null, 0], [6, "product_description", "VARCHAR(255)", 0, null, 0], [7, "other_product_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["product_id"], "foreign_keys": [[0, 0, "Ref_Colors", "color_code", "color_code", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Ref_Product_Categories", "product_category_code", "product_category_code", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Product_Characteristics": {"columns": [[0, "product_id", "INTEGER", 1, null, 0], [1, "characteristic_id", "INTEGER", 1, null, 0], [2, "product_characteristic_value", "VARCHAR(50)", 0, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "Products", "product_id", "product_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Characteristics", "characteristic_id", "characteristic_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}}
CREATE TABLE Ref_Characteristic_Types (
    characteristic_type_code VARCHAR(15)   PRIMARY KEY,
    characteristic_type_description VARCHAR(80),
    UNIQUE (characteristic_type_code)
);

CREATE TABLE Ref_Colors (
    color_code VARCHAR(15)   PRIMARY KEY,
    color_description VARCHAR(80),
    UNIQUE (color_code)
);

CREATE TABLE Ref_Product_Categories (
    product_category_code VARCHAR(15)   PRIMARY KEY,
    product_category_description VARCHAR(80),
    unit_of_measure VARCHAR(20),
    UNIQUE (product_category_code)
);

CREATE TABLE Characteristics (
    characteristic_id INTEGER   PRIMARY KEY,
    characteristic_type_code VARCHAR(15) NOT NULL,
    characteristic_data_type VARCHAR(10),
    characteristic_name VARCHAR(80),
    other_characteristic_details VARCHAR(255),
    FOREIGN KEY (characteristic_type_code) REFERENCES Ref_Characteristic_Types(characteristic_type_code)
);

CREATE TABLE Products (
    product_id INTEGER   PRIMARY KEY,
    color_code VARCHAR(15) NOT NULL,
    product_category_code VARCHAR(15) NOT NULL,
    product_name VARCHAR(80),
    typical_buying_price VARCHAR(20),
    typical_selling_price VARCHAR(20),
    product_description VARCHAR(255),
    other_product_details VARCHAR(255),
    FOREIGN KEY (color_code) REFERENCES Ref_Colors(color_code),
    FOREIGN KEY (product_category_code) REFERENCES Ref_Product_Categories(product_category_code)
);

CREATE TABLE Product_Characteristics (
    product_id INTEGER NOT NULL,
    characteristic_id INTEGER NOT NULL,
    product_characteristic_value VARCHAR(50),
    FOREIGN KEY (product_id) REFERENCES Products(product_id),
    FOREIGN KEY (characteristic_id) REFERENCES Characteristics(characteristic_id)
);