human
Schema:
Customers (customer_id, customer_name, customer_details)
Invoices (invoice_number, invoice_date, invoice_details)
Orders (order_id, customer_id, order_status, date_order_placed, order_details)
Products (product_id, product_name, product_details)
Order_Items (order_item_id, product_id, order_id, order_item_status, order_item_details)
Shipments (shipment_id, order_id, invoice_number, shipment_tracking_number, shipment_date, other_shipment_details)
Shipment_Items (shipment_id, order_item_id)
Please answer with SQL.
assistant
Sure, I understand.
human
What is the product ID for food?
assistant
SELECT product_id FROM Products WHERE product_name = 'food';
human
What are the order IDs that have those product IDs?
assistant
SELECT T2.order_id FROM Products AS T1 JOIN Order_Items AS T2 WHERE T1.product_id = T2.product_id AND T1.product_name = 'food';
human
What customer IDs have those order IDs?
assistant
SELECT T3.customer_id FROM Products AS T1 JOIN Order_Items AS T2 JOIN Orders AS T3 WHERE T1.product_id = T2.product_id AND T1.product_name = "food" AND T3.order_id = T2.order_id ;