human
Schema:
Addresses (address_id, address_content, city, zip_postcode, state_province_county, country, other_address_details)
Products (product_id, product_details)
Customers (customer_id, payment_method, customer_name, date_became_customer, other_customer_details)
Customer_Addresses (customer_id, address_id, date_address_from, address_type, date_address_to)
Customer_Contact_Channels (customer_id, channel_code, active_from_date, active_to_date, contact_number)
Customer_Orders (order_id, customer_id, order_status, order_date, order_details)
Order_Items (order_id, product_id, order_quantity)
Please answer with SQL.
assistant
Sure, I understand.
human
Please show me all customers and their contact channels | Do you want the names of customers or id? | names please
assistant
SELECT DISTINCT customer_name , channel_code FROM customers AS t1 JOIN customer_contact_channels AS t2 ON t1.customer_id = t2.customer_id;
human
please show just those customers who's channel code was email
assistant
SELECT DISTINCT customer_name FROM customers AS t1 JOIN customer_contact_channels AS t2 ON t1.customer_id = t2.customer_id WHERE channel_code = 'Email';
human
Please list just Tillman Ernsers contact channel
assistant
SELECT DISTINCT channel_code FROM customers AS t1 JOIN customer_contact_channels AS t2 ON t1.customer_id = t2.customer_id WHERE customer_name = "Tillman Ernser" ;