{"Addresses": {"columns": [[0, "address_id", "INTEGER", 0, null, 1], [1, "address_content", "VARCHAR(80)", 0, null, 0], [2, "city", "VARCHAR(50)", 0, null, 0], [3, "zip_postcode", "VARCHAR(20)", 0, null, 0], [4, "state_province_county", "VARCHAR(50)", 0, null, 0], [5, "country", "VARCHAR(50)", 0, null, 0], [6, "other_address_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["address_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Products": {"columns": [[0, "product_id", "INTEGER", 0, null, 1], [1, "product_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["product_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Customers": {"columns": [[0, "customer_id", "INTEGER", 0, null, 1], [1, "payment_method", "VARCHAR(15)", 1, null, 0], [2, "customer_name", "VARCHAR(80)", 0, null, 0], [3, "date_became_customer", "DATETIME", 0, null, 0], [4, "other_customer_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["customer_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Customer_Addresses": {"columns": [[0, "customer_id", "INTEGER", 1, null, 0], [1, "address_id", "INTEGER", 1, null, 0], [2, "date_address_from", "DATETIME", 1, null, 0], [3, "address_type", "VARCHAR(15)", 1, null, 0], [4, "date_address_to", "DATETIME", 0, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "Customers", "customer_id", "customer_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Addresses", "address_id", "address_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Customer_Contact_Channels": {"columns": [[0, "customer_id", "INTEGER", 1, null, 0], [1, "channel_code", "VARCHAR(15)", 1, null, 0], [2, "active_from_date", "DATETIME", 1, null, 0], [3, "active_to_date", "DATETIME", 0, null, 0], [4, "contact_number", "VARCHAR(50)", 1, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "Customers", "customer_id", "customer_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Customer_Orders": {"columns": [[0, "order_id", "INTEGER", 0, null, 1], [1, "customer_id", "INTEGER", 1, null, 0], [2, "order_status", "VARCHAR(15)", 1, null, 0], [3, "order_date", "DATETIME", 0, null, 0], [4, "order_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["order_id"], "foreign_keys": [[0, 0, "Customers", "customer_id", "customer_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Order_Items": {"columns": [[0, "order_id", "INTEGER", 1, null, 0], [1, "product_id", "INTEGER", 1, null, 0], [2, "order_quantity", "VARCHAR(15)", 0, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "Customer_Orders", "order_id", "order_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Products", "product_id", "product_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}}
CREATE TABLE Addresses (
    address_id INTEGER   PRIMARY KEY,
    address_content VARCHAR(80),
    city VARCHAR(50),
    zip_postcode VARCHAR(20),
    state_province_county VARCHAR(50),
    country VARCHAR(50),
    other_address_details VARCHAR(255)
);

CREATE TABLE Products (
    product_id INTEGER   PRIMARY KEY,
    product_details VARCHAR(255)
);

CREATE TABLE Customers (
    customer_id INTEGER   PRIMARY KEY,
    payment_method VARCHAR(15) NOT NULL,
    customer_name VARCHAR(80),
    date_became_customer DATETIME,
    other_customer_details VARCHAR(255)
);

CREATE TABLE Customer_Addresses (
    customer_id INTEGER NOT NULL,
    address_id INTEGER NOT NULL,
    date_address_from DATETIME NOT NULL,
    address_type VARCHAR(15) NOT NULL,
    date_address_to DATETIME,
    FOREIGN KEY (customer_id) REFERENCES Customers(customer_id),
    FOREIGN KEY (address_id) REFERENCES Addresses(address_id)
);

CREATE TABLE Customer_Contact_Channels (
    customer_id INTEGER NOT NULL,
    channel_code VARCHAR(15) NOT NULL,
    active_from_date DATETIME NOT NULL,
    active_to_date DATETIME,
    contact_number VARCHAR(50) NOT NULL,
    FOREIGN KEY (customer_id) REFERENCES Customers(customer_id)
);

CREATE TABLE Customer_Orders (
    order_id INTEGER   PRIMARY KEY,
    customer_id INTEGER NOT NULL,
    order_status VARCHAR(15) NOT NULL,
    order_date DATETIME,
    order_details VARCHAR(255),
    FOREIGN KEY (customer_id) REFERENCES Customers(customer_id)
);

CREATE TABLE Order_Items (
    order_id INTEGER NOT NULL,
    product_id INTEGER NOT NULL,
    order_quantity VARCHAR(15),
    FOREIGN KEY (order_id) REFERENCES Customer_Orders(order_id),
    FOREIGN KEY (product_id) REFERENCES Products(product_id)
);