{"Ref_Payment_Methods": {"columns": [[0, "payment_method_code", "CHAR(10)", 1, null, 1], [1, "payment_method_description", "VARCHAR(80)", 0, null, 0]], "primary_keys": ["payment_method_code"], "foreign_keys": [], "unique_constraints": [[[0, 0, "payment_method_code"]]], "check_constraints": []}, "Ref_Service_Types": {"columns": [[0, "Service_Type_Code", "CHAR(15)", 1, null, 1], [1, "Parent_Service_Type_Code", "CHAR(15)", 0, null, 0], [2, "Service_Type_Description", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Service_Type_Code"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Service_Type_Code"]]], "check_constraints": []}, "Addresses": {"columns": [[0, "Address_ID", "VARCHAR(100)", 1, null, 1], [1, "Line_1", "VARCHAR(255)", 0, null, 0], [2, "Line_2", "VARCHAR(255)", 0, null, 0], [3, "City_Town", "VARCHAR(255)", 0, null, 0], [4, "State_County", "VARCHAR(255)", 0, null, 0], [5, "Other_Details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Address_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Address_ID"]]], "check_constraints": []}, "Products": {"columns": [[0, "Product_ID", "VARCHAR(100)", 1, null, 1], [1, "Product_Name", "VARCHAR(255)", 0, null, 0], [2, "Product_Price", "DECIMAL(20,4)", 0, null, 0], [3, "Product_Description", "VARCHAR(255)", 0, null, 0], [4, "Other_Product_Service_Details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Product_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Product_ID"]]], "check_constraints": []}, "Marketing_Regions": {"columns": [[0, "Marketing_Region_Code", "CHAR(15)", 1, null, 1], [1, "Marketing_Region_Name", "VARCHAR(255)", 1, null, 0], [2, "Marketing_Region_Descriptrion", "VARCHAR(255)", 1, null, 0], [3, "Other_Details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Marketing_Region_Code"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Marketing_Region_Code"]]], "check_constraints": []}, "Clients": {"columns": [[0, "Client_ID", "INTEGER", 1, null, 1], [1, "Address_ID", "INTEGER", 1, null, 0], [2, "Customer_Email_Address", "VARCHAR(255)", 0, null, 0], [3, "Customer_Name", "VARCHAR(255)", 0, null, 0], [4, "Customer_Phone", "VARCHAR(255)", 0, null, 0], [5, "Other_Details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Client_ID"], "foreign_keys": [[0, 0, "Addresses", "Address_ID", "Address_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Client_ID"]]], "check_constraints": []}, "Drama_Workshop_Groups": {"columns": [[0, "Workshop_Group_ID", "INTEGER", 1, null, 1], [1, "Address_ID", "INTEGER", 1, null, 0], [2, "Currency_Code", "CHAR(15)", 1, null, 0], [3, "Marketing_Region_Code", "CHAR(15)", 1, null, 0], [4, "Store_Name", "VARCHAR(255)", 0, null, 0], [5, "Store_Phone", "VARCHAR(255)", 0, null, 0], [6, "Store_Email_Address", "VARCHAR(255)", 0, null, 0], [7, "Other_Details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Workshop_Group_ID"], "foreign_keys": [[0, 0, "Addresses", "Address_ID", "Address_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Workshop_Group_ID"]]], "check_constraints": []}, "Performers": {"columns": [[0, "Performer_ID", "INTEGER", 1, null, 1], [1, "Address_ID", "INTEGER", 1, null, 0], [2, "Customer_Name", "VARCHAR(255)", 0, null, 0], [3, "Customer_Phone", "VARCHAR(255)", 0, null, 0], [4, "Customer_Email_Address", "VARCHAR(255)", 0, null, 0], [5, "Other_Details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Performer_ID"], "foreign_keys": [[0, 0, "Addresses", "Address_ID", "Address_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Performer_ID"]]], "check_constraints": []}, "Customers": {"columns": [[0, "Customer_ID", "VARCHAR(100)", 1, null, 1], [1, "Address_ID", "INTEGER", 1, null, 0], [2, "Customer_Name", "VARCHAR(255)", 0, null, 0], [3, "Customer_Phone", "VARCHAR(255)", 0, null, 0], [4, "Customer_Email_Address", "VARCHAR(255)", 0, null, 0], [5, "Other_Details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Customer_ID"], "foreign_keys": [[0, 0, "Addresses", "Address_ID", "Address_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Customer_ID"]]], "check_constraints": []}, "Stores": {"columns": [[0, "Store_ID", "VARCHAR(100)", 1, null, 1], [1, "Address_ID", "INTEGER", 1, null, 0], [2, "Marketing_Region_Code", "CHAR(15)", 1, null, 0], [3, "Store_Name", "VARCHAR(255)", 0, null, 0], [4, "Store_Phone", "VARCHAR(255)", 0, null, 0], [5, "Store_Email_Address", "VARCHAR(255)", 0, null, 0], [6, "Other_Details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Store_ID"], "foreign_keys": [[0, 0, "Marketing_Regions", "Marketing_Region_Code", "Marketing_Region_Code", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Addresses", "Address_ID", "Address_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Store_ID"]]], "check_constraints": []}, "Bookings": {"columns": [[0, "Booking_ID", "INTEGER", 1, null, 1], [1, "Customer_ID", "INTEGER", 1, null, 0], [2, "Workshop_Group_ID", "VARCHAR(100)", 1, null, 0], [3, "Status_Code", "CHAR(15)", 1, null, 0], [4, "Store_ID", "INTEGER", 1, null, 0], [5, "Order_Date", "DATETIME", 1, null, 0], [6, "Planned_Delivery_Date", "DATETIME", 1, null, 0], [7, "Actual_Delivery_Date", "DATETIME", 1, null, 0], [8, "Other_Order_Details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Booking_ID"], "foreign_keys": [[0, 0, "Drama_Workshop_Groups", "Workshop_Group_ID", "Workshop_Group_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Clients", "Customer_ID", "Client_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Booking_ID"]]], "check_constraints": []}, "Performers_in_Bookings": {"columns": [[0, "Order_ID", "INTEGER", 1, null, 1], [1, "Performer_ID", "INTEGER", 1, null, 2]], "primary_keys": ["Order_ID", "Performer_ID"], "foreign_keys": [[0, 0, "Bookings", "Order_ID", "Booking_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Performers", "Performer_ID", "Performer_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Order_ID"], [1, 1, "Performer_ID"]]], "check_constraints": []}, "Customer_Orders": {"columns": [[0, "Order_ID", "INTEGER", 1, null, 1], [1, "Customer_ID", "INTEGER", 1, null, 0], [2, "Store_ID", "INTEGER", 1, null, 0], [3, "Order_Date", "DATETIME", 1, null, 0], [4, "Planned_Delivery_Date", "DATETIME", 1, null, 0], [5, "Actual_Delivery_Date", "DATETIME", 1, null, 0], [6, "Other_Order_Details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Order_ID"], "foreign_keys": [[0, 0, "Stores", "Store_ID", "Store_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Customers", "Customer_ID", "Customer_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Order_ID"]]], "check_constraints": []}, "Order_Items": {"columns": [[0, "Order_Item_ID", "INTEGER", 1, null, 1], [1, "Order_ID", "INTEGER", 1, null, 0], [2, "Product_ID", "INTEGER", 1, null, 0], [3, "Order_Quantity", "VARCHAR(288)", 0, null, 0], [4, "Other_Item_Details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Order_Item_ID"], "foreign_keys": [[0, 0, "Products", "Product_ID", "Product_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Customer_Orders", "Order_ID", "Order_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Invoices": {"columns": [[0, "Invoice_ID", "INTEGER", 1, null, 1], [1, "Order_ID", "INTEGER", 1, null, 0], [2, "payment_method_code", "CHAR(15)", 0, null, 0], [3, "Product_ID", "INTEGER", 1, null, 0], [4, "Order_Quantity", "VARCHAR(288)", 0, null, 0], [5, "Other_Item_Details", "VARCHAR(255)", 0, null, 0], [6, "Order_Item_ID", "INTEGER", 1, null, 0]], "primary_keys": ["Invoice_ID"], "foreign_keys": [[0, 0, "Ref_Payment_Methods", "payment_method_code", "payment_method_code", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Bookings", "Order_ID", "Booking_ID", "NO ACTION", "NO ACTION", "NONE"], [2, 0, "Customer_Orders", "Order_ID", "Order_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Services": {"columns": [[0, "Service_ID", "INTEGER", 1, null, 1], [1, "Service_Type_Code", "CHAR(15)", 0, null, 0], [2, "Workshop_Group_ID", "INTEGER", 1, null, 0], [3, "Product_Description", "VARCHAR(255)", 0, null, 0], [4, "Product_Name", "VARCHAR(255)", 0, null, 0], [5, "Product_Price", "DECIMAL(20,4)", 0, null, 0], [6, "Other_Product_Service_Details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Service_ID"], "foreign_keys": [[0, 0, "Ref_Service_Types", "Service_Type_Code", "Service_Type_Code", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Drama_Workshop_Groups", "Workshop_Group_ID", "Workshop_Group_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Service_ID"]]], "check_constraints": []}, "Bookings_Services": {"columns": [[0, "Order_ID", "INTEGER", 1, null, 1], [1, "Product_ID", "INTEGER", 1, null, 2]], "primary_keys": ["Order_ID", "Product_ID"], "foreign_keys": [[0, 0, "Services", "Product_ID", "Service_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Bookings", "Order_ID", "Booking_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Order_ID"], [1, 1, "Product_ID"]]], "check_constraints": []}, "Invoice_Items": {"columns": [[0, "Invoice_Item_ID", "INTEGER", 1, null, 1], [1, "Invoice_ID", "INTEGER", 1, null, 0], [2, "Order_ID", "INTEGER", 1, null, 0], [3, "Order_Item_ID", "INTEGER", 1, null, 0], [4, "Product_ID", "INTEGER", 1, null, 0], [5, "Order_Quantity", "INTEGER", 0, null, 0], [6, "Other_Item_Details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Invoice_Item_ID"], "foreign_keys": [[0, 0, "Bookings_Services", "Order_ID", "Order_ID", "NO ACTION", "NO ACTION", "NONE"], [0, 1, "Bookings_Services", "Product_ID", "Product_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Invoices", "Invoice_ID", "Invoice_ID", "NO ACTION", "NO ACTION", "NONE"], [2, 0, "Order_Items", "Order_Item_ID", "Order_Item_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}}
CREATE TABLE Ref_Payment_Methods (
    payment_method_code CHAR(10) NOT NULL  PRIMARY KEY,
    payment_method_description VARCHAR(80),
    UNIQUE (payment_method_code)
);

CREATE TABLE Ref_Service_Types (
    Service_Type_Code CHAR(15) NOT NULL  PRIMARY KEY,
    Parent_Service_Type_Code CHAR(15),
    Service_Type_Description VARCHAR(255),
    UNIQUE (Service_Type_Code)
);

CREATE TABLE Addresses (
    Address_ID VARCHAR(100) NOT NULL  PRIMARY KEY,
    Line_1 VARCHAR(255),
    Line_2 VARCHAR(255),
    City_Town VARCHAR(255),
    State_County VARCHAR(255),
    Other_Details VARCHAR(255),
    UNIQUE (Address_ID)
);

CREATE TABLE Products (
    Product_ID VARCHAR(100) NOT NULL  PRIMARY KEY,
    Product_Name VARCHAR(255),
    Product_Price DECIMAL(20,4),
    Product_Description VARCHAR(255),
    Other_Product_Service_Details VARCHAR(255),
    UNIQUE (Product_ID)
);

CREATE TABLE Marketing_Regions (
    Marketing_Region_Code CHAR(15) NOT NULL  PRIMARY KEY,
    Marketing_Region_Name VARCHAR(255) NOT NULL,
    Marketing_Region_Descriptrion VARCHAR(255) NOT NULL,
    Other_Details VARCHAR(255),
    UNIQUE (Marketing_Region_Code)
);

CREATE TABLE Clients (
    Client_ID INTEGER NOT NULL  PRIMARY KEY,
    Address_ID INTEGER NOT NULL,
    Customer_Email_Address VARCHAR(255),
    Customer_Name VARCHAR(255),
    Customer_Phone VARCHAR(255),
    Other_Details VARCHAR(255),
    UNIQUE (Client_ID),
    FOREIGN KEY (Address_ID) REFERENCES Addresses(Address_ID)
);

CREATE TABLE Drama_Workshop_Groups (
    Workshop_Group_ID INTEGER NOT NULL  PRIMARY KEY,
    Address_ID INTEGER NOT NULL,
    Currency_Code CHAR(15) NOT NULL,
    Marketing_Region_Code CHAR(15) NOT NULL,
    Store_Name VARCHAR(255),
    Store_Phone VARCHAR(255),
    Store_Email_Address VARCHAR(255),
    Other_Details VARCHAR(255),
    UNIQUE (Workshop_Group_ID),
    FOREIGN KEY (Address_ID) REFERENCES Addresses(Address_ID)
);

CREATE TABLE Performers (
    Performer_ID INTEGER NOT NULL  PRIMARY KEY,
    Address_ID INTEGER NOT NULL,
    Customer_Name VARCHAR(255),
    Customer_Phone VARCHAR(255),
    Customer_Email_Address VARCHAR(255),
    Other_Details VARCHAR(255),
    UNIQUE (Performer_ID),
    FOREIGN KEY (Address_ID) REFERENCES Addresses(Address_ID)
);

CREATE TABLE Customers (
    Customer_ID VARCHAR(100) NOT NULL  PRIMARY KEY,
    Address_ID INTEGER NOT NULL,
    Customer_Name VARCHAR(255),
    Customer_Phone VARCHAR(255),
    Customer_Email_Address VARCHAR(255),
    Other_Details VARCHAR(255),
    UNIQUE (Customer_ID),
    FOREIGN KEY (Address_ID) REFERENCES Addresses(Address_ID)
);

CREATE TABLE Stores (
    Store_ID VARCHAR(100) NOT NULL  PRIMARY KEY,
    Address_ID INTEGER NOT NULL,
    Marketing_Region_Code CHAR(15) NOT NULL,
    Store_Name VARCHAR(255),
    Store_Phone VARCHAR(255),
    Store_Email_Address VARCHAR(255),
    Other_Details VARCHAR(255),
    UNIQUE (Store_ID),
    FOREIGN KEY (Marketing_Region_Code) REFERENCES Marketing_Regions(Marketing_Region_Code),
    FOREIGN KEY (Address_ID) REFERENCES Addresses(Address_ID)
);

CREATE TABLE Bookings (
    Booking_ID INTEGER NOT NULL  PRIMARY KEY,
    Customer_ID INTEGER NOT NULL,
    Workshop_Group_ID VARCHAR(100) NOT NULL,
    Status_Code CHAR(15) NOT NULL,
    Store_ID INTEGER NOT NULL,
    Order_Date DATETIME NOT NULL,
    Planned_Delivery_Date DATETIME NOT NULL,
    Actual_Delivery_Date DATETIME NOT NULL,
    Other_Order_Details VARCHAR(255),
    UNIQUE (Booking_ID),
    FOREIGN KEY (Workshop_Group_ID) REFERENCES Drama_Workshop_Groups(Workshop_Group_ID),
    FOREIGN KEY (Customer_ID) REFERENCES Clients(Client_ID)
);

CREATE TABLE Performers_in_Bookings (
    Order_ID INTEGER NOT NULL  PRIMARY KEY,
    Performer_ID INTEGER NOT NULL  PRIMARY KEY,
    PRIMARY KEY (Order_ID, Performer_ID),
    UNIQUE (Order_ID, Performer_ID),
    FOREIGN KEY (Order_ID) REFERENCES Bookings(Booking_ID),
    FOREIGN KEY (Performer_ID) REFERENCES Performers(Performer_ID)
);

CREATE TABLE Customer_Orders (
    Order_ID INTEGER NOT NULL  PRIMARY KEY,
    Customer_ID INTEGER NOT NULL,
    Store_ID INTEGER NOT NULL,
    Order_Date DATETIME NOT NULL,
    Planned_Delivery_Date DATETIME NOT NULL,
    Actual_Delivery_Date DATETIME NOT NULL,
    Other_Order_Details VARCHAR(255),
    UNIQUE (Order_ID),
    FOREIGN KEY (Store_ID) REFERENCES Stores(Store_ID),
    FOREIGN KEY (Customer_ID) REFERENCES Customers(Customer_ID)
);

CREATE TABLE Order_Items (
    Order_Item_ID INTEGER NOT NULL  PRIMARY KEY,
    Order_ID INTEGER NOT NULL,
    Product_ID INTEGER NOT NULL,
    Order_Quantity VARCHAR(288),
    Other_Item_Details VARCHAR(255),
    FOREIGN KEY (Product_ID) REFERENCES Products(Product_ID),
    FOREIGN KEY (Order_ID) REFERENCES Customer_Orders(Order_ID)
);

CREATE TABLE Invoices (
    Invoice_ID INTEGER NOT NULL  PRIMARY KEY,
    Order_ID INTEGER NOT NULL,
    payment_method_code CHAR(15),
    Product_ID INTEGER NOT NULL,
    Order_Quantity VARCHAR(288),
    Other_Item_Details VARCHAR(255),
    Order_Item_ID INTEGER NOT NULL,
    FOREIGN KEY (payment_method_code) REFERENCES Ref_Payment_Methods(payment_method_code),
    FOREIGN KEY (Order_ID) REFERENCES Bookings(Booking_ID),
    FOREIGN KEY (Order_ID) REFERENCES Customer_Orders(Order_ID)
);

CREATE TABLE Services (
    Service_ID INTEGER NOT NULL  PRIMARY KEY,
    Service_Type_Code CHAR(15),
    Workshop_Group_ID INTEGER NOT NULL,
    Product_Description VARCHAR(255),
    Product_Name VARCHAR(255),
    Product_Price DECIMAL(20,4),
    Other_Product_Service_Details VARCHAR(255),
    UNIQUE (Service_ID),
    FOREIGN KEY (Service_Type_Code) REFERENCES Ref_Service_Types(Service_Type_Code),
    FOREIGN KEY (Workshop_Group_ID) REFERENCES Drama_Workshop_Groups(Workshop_Group_ID)
);

CREATE TABLE Bookings_Services (
    Order_ID INTEGER NOT NULL  PRIMARY KEY,
    Product_ID INTEGER NOT NULL  PRIMARY KEY,
    PRIMARY KEY (Order_ID, Product_ID),
    UNIQUE (Order_ID, Product_ID),
    FOREIGN KEY (Product_ID) REFERENCES Services(Service_ID),
    FOREIGN KEY (Order_ID) REFERENCES Bookings(Booking_ID)
);

CREATE TABLE Invoice_Items (
    Invoice_Item_ID INTEGER NOT NULL  PRIMARY KEY,
    Invoice_ID INTEGER NOT NULL,
    Order_ID INTEGER NOT NULL,
    Order_Item_ID INTEGER NOT NULL,
    Product_ID INTEGER NOT NULL,
    Order_Quantity INTEGER,
    Other_Item_Details VARCHAR(255),
    FOREIGN KEY (Order_ID) REFERENCES Bookings_Services(Order_ID),
    FOREIGN KEY (Product_ID) REFERENCES Bookings_Services(Product_ID),
    FOREIGN KEY (Invoice_ID) REFERENCES Invoices(Invoice_ID),
    FOREIGN KEY (Order_Item_ID) REFERENCES Order_Items(Order_Item_ID)
);