{"Premises": {"columns": [[0, "premise_id", "INTEGER", 0, null, 1], [1, "premises_type", "VARCHAR(15)", 1, null, 0], [2, "premise_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["premise_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Products": {"columns": [[0, "product_id", "INTEGER", 0, null, 1], [1, "product_category", "VARCHAR(15)", 1, null, 0], [2, "product_name", "VARCHAR(80)", 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, "customer_phone", "VARCHAR(80)", 0, null, 0], [4, "customer_email", "VARCHAR(80)", 0, null, 0], [5, "customer_address", "VARCHAR(255)", 0, null, 0], [6, "customer_login", "VARCHAR(80)", 0, null, 0], [7, "customer_password", "VARCHAR(10)", 0, null, 0]], "primary_keys": ["customer_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Mailshot_Campaigns": {"columns": [[0, "mailshot_id", "INTEGER", 0, null, 1], [1, "product_category", "VARCHAR(15)", 0, null, 0], [2, "mailshot_name", "VARCHAR(80)", 0, null, 0], [3, "mailshot_start_date", "DATETIME", 0, null, 0], [4, "mailshot_end_date", "DATETIME", 0, null, 0]], "primary_keys": ["mailshot_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Customer_Addresses": {"columns": [[0, "customer_id", "INTEGER", 1, null, 0], [1, "premise_id", "INTEGER", 1, null, 0], [2, "date_address_from", "DATETIME", 1, null, 0], [3, "address_type_code", "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, "Premises", "premise_id", "premise_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_code", "VARCHAR(15)", 1, null, 0], [3, "shipping_method_code", "VARCHAR(15)", 1, null, 0], [4, "order_placed_datetime", "DATETIME", 1, null, 0], [5, "order_delivered_datetime", "DATETIME", 0, null, 0], [6, "order_shipping_charges", "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": []}, "Mailshot_Customers": {"columns": [[0, "mailshot_id", "INTEGER", 1, null, 0], [1, "customer_id", "INTEGER", 1, null, 0], [2, "outcome_code", "VARCHAR(15)", 1, null, 0], [3, "mailshot_customer_date", "DATETIME", 0, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "Mailshot_Campaigns", "mailshot_id", "mailshot_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Customers", "customer_id", "customer_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Order_Items": {"columns": [[0, "item_id", "INTEGER", 1, null, 0], [1, "order_item_status_code", "VARCHAR(15)", 1, null, 0], [2, "order_id", "INTEGER", 1, null, 0], [3, "product_id", "INTEGER", 1, null, 0], [4, "item_status_code", "VARCHAR(15)", 0, null, 0], [5, "item_delivered_datetime", "DATETIME", 0, null, 0], [6, "item_order_quantity", "VARCHAR(80)", 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 Premises (
    premise_id INTEGER   PRIMARY KEY,
    premises_type VARCHAR(15) NOT NULL,
    premise_details VARCHAR(255)
);

CREATE TABLE Products (
    product_id INTEGER   PRIMARY KEY,
    product_category VARCHAR(15) NOT NULL,
    product_name VARCHAR(80)
);

CREATE TABLE Customers (
    customer_id INTEGER   PRIMARY KEY,
    payment_method VARCHAR(15) NOT NULL,
    customer_name VARCHAR(80),
    customer_phone VARCHAR(80),
    customer_email VARCHAR(80),
    customer_address VARCHAR(255),
    customer_login VARCHAR(80),
    customer_password VARCHAR(10)
);

CREATE TABLE Mailshot_Campaigns (
    mailshot_id INTEGER   PRIMARY KEY,
    product_category VARCHAR(15),
    mailshot_name VARCHAR(80),
    mailshot_start_date DATETIME,
    mailshot_end_date DATETIME
);

CREATE TABLE Customer_Addresses (
    customer_id INTEGER NOT NULL,
    premise_id INTEGER NOT NULL,
    date_address_from DATETIME NOT NULL,
    address_type_code VARCHAR(15) NOT NULL,
    date_address_to DATETIME,
    FOREIGN KEY (customer_id) REFERENCES Customers(customer_id),
    FOREIGN KEY (premise_id) REFERENCES Premises(premise_id)
);

CREATE TABLE Customer_Orders (
    order_id INTEGER   PRIMARY KEY,
    customer_id INTEGER NOT NULL,
    order_status_code VARCHAR(15) NOT NULL,
    shipping_method_code VARCHAR(15) NOT NULL,
    order_placed_datetime DATETIME NOT NULL,
    order_delivered_datetime DATETIME,
    order_shipping_charges VARCHAR(255),
    FOREIGN KEY (customer_id) REFERENCES Customers(customer_id)
);

CREATE TABLE Mailshot_Customers (
    mailshot_id INTEGER NOT NULL,
    customer_id INTEGER NOT NULL,
    outcome_code VARCHAR(15) NOT NULL,
    mailshot_customer_date DATETIME,
    FOREIGN KEY (mailshot_id) REFERENCES Mailshot_Campaigns(mailshot_id),
    FOREIGN KEY (customer_id) REFERENCES Customers(customer_id)
);

CREATE TABLE Order_Items (
    item_id INTEGER NOT NULL,
    order_item_status_code VARCHAR(15) NOT NULL,
    order_id INTEGER NOT NULL,
    product_id INTEGER NOT NULL,
    item_status_code VARCHAR(15),
    item_delivered_datetime DATETIME,
    item_order_quantity VARCHAR(80),
    FOREIGN KEY (order_id) REFERENCES Customer_Orders(order_id),
    FOREIGN KEY (product_id) REFERENCES Products(product_id)
);