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
Hi who made the latest order?
assistant
SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id ORDER BY t2.order_date DESC LIMIT 1;
human
How many people canceled their orders
assistant
SELECT COUNT( distinct customer_id ) FROM customer_orders WHERE order_status = 'Cancelled';
human
How many times has Eunice Morar placed an order
assistant
SELECT COUNT( * ) FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id WHERE t1.customer_name = 'Eunice Morar';
human
How did Eunic Morar pay?
assistant
SELECT payment_method FROM customers WHERE customer_name = "Eunice Morar" ;