Question: What are the ids of products from the supplier with id 2, which are more expensive than the average price across all products?

addresses : address_id (number) , address_details (text) | staff : staff_id (number) , staff_gender (text) , staff_name (text) | suppliers : supplier_id (number) , supplier_name (text) , supplier_phone (text) | department_store_chain : dept_store_chain_id (number) , dept_store_chain_name (text) | customers : customer_id (number) , payment_method_code (text) , customer_code (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | supplier_addresses : supplier_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_addresses : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_status_code (text) , order_date (time) | department_stores : dept_store_id (number) , dept_store_chain_id (number) , store_name (text) , store_address (text) , store_phone (text) , store_email (text) | departments : department_id (number) , dept_store_id (number) , department_name (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) | product_suppliers : product_id (number) , supplier_id (number) , date_supplied_from (time) , date_supplied_to (time) , total_amount_purchased (text) , total_value_purchased (number) | staff_department_assignments : staff_id (number) , department_id (number) , date_assigned_from (time) , job_title_code (text) , date_assigned_to (time)

products : product_id (number) , product_price (number) | product_suppliers : product_id (number) , supplier_id (number)


Question: What is the id and name of the department store that has both marketing and managing department?

addresses : address_id (number) , address_details (text) | staff : staff_id (number) , staff_gender (text) , staff_name (text) | suppliers : supplier_id (number) , supplier_name (text) , supplier_phone (text) | department_store_chain : dept_store_chain_id (number) , dept_store_chain_name (text) | customers : customer_id (number) , payment_method_code (text) , customer_code (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | supplier_addresses : supplier_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_addresses : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_status_code (text) , order_date (time) | department_stores : dept_store_id (number) , dept_store_chain_id (number) , store_name (text) , store_address (text) , store_phone (text) , store_email (text) | departments : department_id (number) , dept_store_id (number) , department_name (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) | product_suppliers : product_id (number) , supplier_id (number) , date_supplied_from (time) , date_supplied_to (time) , total_amount_purchased (text) , total_value_purchased (number) | staff_department_assignments : staff_id (number) , department_id (number) , date_assigned_from (time) , job_title_code (text) , date_assigned_to (time)

department_stores : dept_store_id (number) , store_name (text) | departments : dept_store_id (number) , department_name (text)


Question: What are the ids and names of department stores with both marketing and managing departments?

addresses : address_id (number) , address_details (text) | staff : staff_id (number) , staff_gender (text) , staff_name (text) | suppliers : supplier_id (number) , supplier_name (text) , supplier_phone (text) | department_store_chain : dept_store_chain_id (number) , dept_store_chain_name (text) | customers : customer_id (number) , payment_method_code (text) , customer_code (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | supplier_addresses : supplier_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_addresses : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_status_code (text) , order_date (time) | department_stores : dept_store_id (number) , dept_store_chain_id (number) , store_name (text) , store_address (text) , store_phone (text) , store_email (text) | departments : department_id (number) , dept_store_id (number) , department_name (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) | product_suppliers : product_id (number) , supplier_id (number) , date_supplied_from (time) , date_supplied_to (time) , total_amount_purchased (text) , total_value_purchased (number) | staff_department_assignments : staff_id (number) , department_id (number) , date_assigned_from (time) , job_title_code (text) , date_assigned_to (time)

department_stores : dept_store_id (number) , store_name (text) | departments : dept_store_id (number) , department_name (text)


Question: What are the ids of the two department store chains with the largest number of department stores?

addresses : address_id (number) , address_details (text) | staff : staff_id (number) , staff_gender (text) , staff_name (text) | suppliers : supplier_id (number) , supplier_name (text) , supplier_phone (text) | department_store_chain : dept_store_chain_id (number) , dept_store_chain_name (text) | customers : customer_id (number) , payment_method_code (text) , customer_code (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | supplier_addresses : supplier_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_addresses : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_status_code (text) , order_date (time) | department_stores : dept_store_id (number) , dept_store_chain_id (number) , store_name (text) , store_address (text) , store_phone (text) , store_email (text) | departments : department_id (number) , dept_store_id (number) , department_name (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) | product_suppliers : product_id (number) , supplier_id (number) , date_supplied_from (time) , date_supplied_to (time) , total_amount_purchased (text) , total_value_purchased (number) | staff_department_assignments : staff_id (number) , department_id (number) , date_assigned_from (time) , job_title_code (text) , date_assigned_to (time)

department_stores : dept_store_chain_id (number) , dept_store_id (number)


Question: Return the ids of the two department store chains with the most department stores.

addresses : address_id (number) , address_details (text) | staff : staff_id (number) , staff_gender (text) , staff_name (text) | suppliers : supplier_id (number) , supplier_name (text) , supplier_phone (text) | department_store_chain : dept_store_chain_id (number) , dept_store_chain_name (text) | customers : customer_id (number) , payment_method_code (text) , customer_code (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | supplier_addresses : supplier_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_addresses : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_status_code (text) , order_date (time) | department_stores : dept_store_id (number) , dept_store_chain_id (number) , store_name (text) , store_address (text) , store_phone (text) , store_email (text) | departments : department_id (number) , dept_store_id (number) , department_name (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) | product_suppliers : product_id (number) , supplier_id (number) , date_supplied_from (time) , date_supplied_to (time) , total_amount_purchased (text) , total_value_purchased (number) | staff_department_assignments : staff_id (number) , department_id (number) , date_assigned_from (time) , job_title_code (text) , date_assigned_to (time)

department_stores : dept_store_chain_id (number) , dept_store_id (number)


Question: What is the id of the department with the least number of staff?

addresses : address_id (number) , address_details (text) | staff : staff_id (number) , staff_gender (text) , staff_name (text) | suppliers : supplier_id (number) , supplier_name (text) , supplier_phone (text) | department_store_chain : dept_store_chain_id (number) , dept_store_chain_name (text) | customers : customer_id (number) , payment_method_code (text) , customer_code (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | supplier_addresses : supplier_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_addresses : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_status_code (text) , order_date (time) | department_stores : dept_store_id (number) , dept_store_chain_id (number) , store_name (text) , store_address (text) , store_phone (text) , store_email (text) | departments : department_id (number) , dept_store_id (number) , department_name (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) | product_suppliers : product_id (number) , supplier_id (number) , date_supplied_from (time) , date_supplied_to (time) , total_amount_purchased (text) , total_value_purchased (number) | staff_department_assignments : staff_id (number) , department_id (number) , date_assigned_from (time) , job_title_code (text) , date_assigned_to (time)

staff_department_assignments : department_id (number) , staff_id (number)


Question: Return the id of the department with the fewest staff assignments.

addresses : address_id (number) , address_details (text) | staff : staff_id (number) , staff_gender (text) , staff_name (text) | suppliers : supplier_id (number) , supplier_name (text) , supplier_phone (text) | department_store_chain : dept_store_chain_id (number) , dept_store_chain_name (text) | customers : customer_id (number) , payment_method_code (text) , customer_code (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | supplier_addresses : supplier_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_addresses : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_status_code (text) , order_date (time) | department_stores : dept_store_id (number) , dept_store_chain_id (number) , store_name (text) , store_address (text) , store_phone (text) , store_email (text) | departments : department_id (number) , dept_store_id (number) , department_name (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) | product_suppliers : product_id (number) , supplier_id (number) , date_supplied_from (time) , date_supplied_to (time) , total_amount_purchased (text) , total_value_purchased (number) | staff_department_assignments : staff_id (number) , department_id (number) , date_assigned_from (time) , job_title_code (text) , date_assigned_to (time)

staff_department_assignments : department_id (number) , staff_id (number)


Question: For each product type, return the maximum and minimum price.

addresses : address_id (number) , address_details (text) | staff : staff_id (number) , staff_gender (text) , staff_name (text) | suppliers : supplier_id (number) , supplier_name (text) , supplier_phone (text) | department_store_chain : dept_store_chain_id (number) , dept_store_chain_name (text) | customers : customer_id (number) , payment_method_code (text) , customer_code (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | supplier_addresses : supplier_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_addresses : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_status_code (text) , order_date (time) | department_stores : dept_store_id (number) , dept_store_chain_id (number) , store_name (text) , store_address (text) , store_phone (text) , store_email (text) | departments : department_id (number) , dept_store_id (number) , department_name (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) | product_suppliers : product_id (number) , supplier_id (number) , date_supplied_from (time) , date_supplied_to (time) , total_amount_purchased (text) , total_value_purchased (number) | staff_department_assignments : staff_id (number) , department_id (number) , date_assigned_from (time) , job_title_code (text) , date_assigned_to (time)

products : product_type_code (text) , product_price (number)


Question: What are the maximum and minimum product prices for each product type?

addresses : address_id (number) , address_details (text) | staff : staff_id (number) , staff_gender (text) , staff_name (text) | suppliers : supplier_id (number) , supplier_name (text) , supplier_phone (text) | department_store_chain : dept_store_chain_id (number) , dept_store_chain_name (text) | customers : customer_id (number) , payment_method_code (text) , customer_code (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | supplier_addresses : supplier_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_addresses : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_status_code (text) , order_date (time) | department_stores : dept_store_id (number) , dept_store_chain_id (number) , store_name (text) , store_address (text) , store_phone (text) , store_email (text) | departments : department_id (number) , dept_store_id (number) , department_name (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) | product_suppliers : product_id (number) , supplier_id (number) , date_supplied_from (time) , date_supplied_to (time) , total_amount_purchased (text) , total_value_purchased (number) | staff_department_assignments : staff_id (number) , department_id (number) , date_assigned_from (time) , job_title_code (text) , date_assigned_to (time)

products : product_type_code (text) , product_price (number)


Question: Find the product type whose average price is higher than the average price of all products.

addresses : address_id (number) , address_details (text) | staff : staff_id (number) , staff_gender (text) , staff_name (text) | suppliers : supplier_id (number) , supplier_name (text) , supplier_phone (text) | department_store_chain : dept_store_chain_id (number) , dept_store_chain_name (text) | customers : customer_id (number) , payment_method_code (text) , customer_code (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | supplier_addresses : supplier_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_addresses : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_status_code (text) , order_date (time) | department_stores : dept_store_id (number) , dept_store_chain_id (number) , store_name (text) , store_address (text) , store_phone (text) , store_email (text) | departments : department_id (number) , dept_store_id (number) , department_name (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) | product_suppliers : product_id (number) , supplier_id (number) , date_supplied_from (time) , date_supplied_to (time) , total_amount_purchased (text) , total_value_purchased (number) | staff_department_assignments : staff_id (number) , department_id (number) , date_assigned_from (time) , job_title_code (text) , date_assigned_to (time)

products : product_type_code (text) , product_price (number)


Question: What is the code of the product type with an average price higher than the average price of all products?

addresses : address_id (number) , address_details (text) | staff : staff_id (number) , staff_gender (text) , staff_name (text) | suppliers : supplier_id (number) , supplier_name (text) , supplier_phone (text) | department_store_chain : dept_store_chain_id (number) , dept_store_chain_name (text) | customers : customer_id (number) , payment_method_code (text) , customer_code (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | supplier_addresses : supplier_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_addresses : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_status_code (text) , order_date (time) | department_stores : dept_store_id (number) , dept_store_chain_id (number) , store_name (text) , store_address (text) , store_phone (text) , store_email (text) | departments : department_id (number) , dept_store_id (number) , department_name (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) | product_suppliers : product_id (number) , supplier_id (number) , date_supplied_from (time) , date_supplied_to (time) , total_amount_purchased (text) , total_value_purchased (number) | staff_department_assignments : staff_id (number) , department_id (number) , date_assigned_from (time) , job_title_code (text) , date_assigned_to (time)

products : product_type_code (text) , product_price (number)


Question: Find the id and name of the staff who has been assigned for the shortest period.

addresses : address_id (number) , address_details (text) | staff : staff_id (number) , staff_gender (text) , staff_name (text) | suppliers : supplier_id (number) , supplier_name (text) , supplier_phone (text) | department_store_chain : dept_store_chain_id (number) , dept_store_chain_name (text) | customers : customer_id (number) , payment_method_code (text) , customer_code (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | supplier_addresses : supplier_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_addresses : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_status_code (text) , order_date (time) | department_stores : dept_store_id (number) , dept_store_chain_id (number) , store_name (text) , store_address (text) , store_phone (text) , store_email (text) | departments : department_id (number) , dept_store_id (number) , department_name (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) | product_suppliers : product_id (number) , supplier_id (number) , date_supplied_from (time) , date_supplied_to (time) , total_amount_purchased (text) , total_value_purchased (number) | staff_department_assignments : staff_id (number) , department_id (number) , date_assigned_from (time) , job_title_code (text) , date_assigned_to (time)

staff : staff_id (number) , staff_name (text) | staff_department_assignments : staff_id (number) , date_assigned_to (time) , date_assigned_from (time)


Question: What is the id and name of the staff who has been assigned for the least amount of time?

addresses : address_id (number) , address_details (text) | staff : staff_id (number) , staff_gender (text) , staff_name (text) | suppliers : supplier_id (number) , supplier_name (text) , supplier_phone (text) | department_store_chain : dept_store_chain_id (number) , dept_store_chain_name (text) | customers : customer_id (number) , payment_method_code (text) , customer_code (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | supplier_addresses : supplier_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_addresses : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_status_code (text) , order_date (time) | department_stores : dept_store_id (number) , dept_store_chain_id (number) , store_name (text) , store_address (text) , store_phone (text) , store_email (text) | departments : department_id (number) , dept_store_id (number) , department_name (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) | product_suppliers : product_id (number) , supplier_id (number) , date_supplied_from (time) , date_supplied_to (time) , total_amount_purchased (text) , total_value_purchased (number) | staff_department_assignments : staff_id (number) , department_id (number) , date_assigned_from (time) , job_title_code (text) , date_assigned_to (time)

staff : staff_id (number) , staff_name (text) | staff_department_assignments : staff_id (number) , date_assigned_to (time) , date_assigned_from (time)


Question: Return the names and ids of all products whose price is between 600 and 700.

addresses : address_id (number) , address_details (text) | staff : staff_id (number) , staff_gender (text) , staff_name (text) | suppliers : supplier_id (number) , supplier_name (text) , supplier_phone (text) | department_store_chain : dept_store_chain_id (number) , dept_store_chain_name (text) | customers : customer_id (number) , payment_method_code (text) , customer_code (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | supplier_addresses : supplier_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_addresses : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_status_code (text) , order_date (time) | department_stores : dept_store_id (number) , dept_store_chain_id (number) , store_name (text) , store_address (text) , store_phone (text) , store_email (text) | departments : department_id (number) , dept_store_id (number) , department_name (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) | product_suppliers : product_id (number) , supplier_id (number) , date_supplied_from (time) , date_supplied_to (time) , total_amount_purchased (text) , total_value_purchased (number) | staff_department_assignments : staff_id (number) , department_id (number) , date_assigned_from (time) , job_title_code (text) , date_assigned_to (time)

products : product_name (text) , product_id (number) , product_price (number)


Question: What are the names and ids of products costing between 600 and 700?

addresses : address_id (number) , address_details (text) | staff : staff_id (number) , staff_gender (text) , staff_name (text) | suppliers : supplier_id (number) , supplier_name (text) , supplier_phone (text) | department_store_chain : dept_store_chain_id (number) , dept_store_chain_name (text) | customers : customer_id (number) , payment_method_code (text) , customer_code (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | supplier_addresses : supplier_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_addresses : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_status_code (text) , order_date (time) | department_stores : dept_store_id (number) , dept_store_chain_id (number) , store_name (text) , store_address (text) , store_phone (text) , store_email (text) | departments : department_id (number) , dept_store_id (number) , department_name (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) | product_suppliers : product_id (number) , supplier_id (number) , date_supplied_from (time) , date_supplied_to (time) , total_amount_purchased (text) , total_value_purchased (number) | staff_department_assignments : staff_id (number) , department_id (number) , date_assigned_from (time) , job_title_code (text) , date_assigned_to (time)

products : product_name (text) , product_id (number) , product_price (number)


Question: Find the ids of all distinct customers who made order after some orders that were Cancelled.

addresses : address_id (number) , address_details (text) | staff : staff_id (number) , staff_gender (text) , staff_name (text) | suppliers : supplier_id (number) , supplier_name (text) , supplier_phone (text) | department_store_chain : dept_store_chain_id (number) , dept_store_chain_name (text) | customers : customer_id (number) , payment_method_code (text) , customer_code (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | supplier_addresses : supplier_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_addresses : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_status_code (text) , order_date (time) | department_stores : dept_store_id (number) , dept_store_chain_id (number) , store_name (text) , store_address (text) , store_phone (text) , store_email (text) | departments : department_id (number) , dept_store_id (number) , department_name (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) | product_suppliers : product_id (number) , supplier_id (number) , date_supplied_from (time) , date_supplied_to (time) , total_amount_purchased (text) , total_value_purchased (number) | staff_department_assignments : staff_id (number) , department_id (number) , date_assigned_from (time) , job_title_code (text) , date_assigned_to (time)

customer_orders : customer_id (number) , order_date (time) , order_status_code (text)


Question: What are the distinct ids of customers who made an order after any order that was Cancelled?

addresses : address_id (number) , address_details (text) | staff : staff_id (number) , staff_gender (text) , staff_name (text) | suppliers : supplier_id (number) , supplier_name (text) , supplier_phone (text) | department_store_chain : dept_store_chain_id (number) , dept_store_chain_name (text) | customers : customer_id (number) , payment_method_code (text) , customer_code (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | supplier_addresses : supplier_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_addresses : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_status_code (text) , order_date (time) | department_stores : dept_store_id (number) , dept_store_chain_id (number) , store_name (text) , store_address (text) , store_phone (text) , store_email (text) | departments : department_id (number) , dept_store_id (number) , department_name (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) | product_suppliers : product_id (number) , supplier_id (number) , date_supplied_from (time) , date_supplied_to (time) , total_amount_purchased (text) , total_value_purchased (number) | staff_department_assignments : staff_id (number) , department_id (number) , date_assigned_from (time) , job_title_code (text) , date_assigned_to (time)

customer_orders : customer_id (number) , order_date (time) , order_status_code (text)


Question: What is id of the staff who had a Staff Department Assignment earlier than any Clerical Staff?

addresses : address_id (number) , address_details (text) | staff : staff_id (number) , staff_gender (text) , staff_name (text) | suppliers : supplier_id (number) , supplier_name (text) , supplier_phone (text) | department_store_chain : dept_store_chain_id (number) , dept_store_chain_name (text) | customers : customer_id (number) , payment_method_code (text) , customer_code (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | supplier_addresses : supplier_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_addresses : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_status_code (text) , order_date (time) | department_stores : dept_store_id (number) , dept_store_chain_id (number) , store_name (text) , store_address (text) , store_phone (text) , store_email (text) | departments : department_id (number) , dept_store_id (number) , department_name (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) | product_suppliers : product_id (number) , supplier_id (number) , date_supplied_from (time) , date_supplied_to (time) , total_amount_purchased (text) , total_value_purchased (number) | staff_department_assignments : staff_id (number) , department_id (number) , date_assigned_from (time) , job_title_code (text) , date_assigned_to (time)

staff_department_assignments : staff_id (number) , date_assigned_to (time) , job_title_code (text)


Question: Return the id of the staff whose Staff Department Assignment was earlier than that of any Clerical Staff.

addresses : address_id (number) , address_details (text) | staff : staff_id (number) , staff_gender (text) , staff_name (text) | suppliers : supplier_id (number) , supplier_name (text) , supplier_phone (text) | department_store_chain : dept_store_chain_id (number) , dept_store_chain_name (text) | customers : customer_id (number) , payment_method_code (text) , customer_code (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | supplier_addresses : supplier_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_addresses : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_status_code (text) , order_date (time) | department_stores : dept_store_id (number) , dept_store_chain_id (number) , store_name (text) , store_address (text) , store_phone (text) , store_email (text) | departments : department_id (number) , dept_store_id (number) , department_name (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) | product_suppliers : product_id (number) , supplier_id (number) , date_supplied_from (time) , date_supplied_to (time) , total_amount_purchased (text) , total_value_purchased (number) | staff_department_assignments : staff_id (number) , department_id (number) , date_assigned_from (time) , job_title_code (text) , date_assigned_to (time)

staff_department_assignments : staff_id (number) , date_assigned_to (time) , job_title_code (text)


Question: What are the names and ids of customers whose address contains TN?

addresses : address_id (number) , address_details (text) | staff : staff_id (number) , staff_gender (text) , staff_name (text) | suppliers : supplier_id (number) , supplier_name (text) , supplier_phone (text) | department_store_chain : dept_store_chain_id (number) , dept_store_chain_name (text) | customers : customer_id (number) , payment_method_code (text) , customer_code (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | supplier_addresses : supplier_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_addresses : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_status_code (text) , order_date (time) | department_stores : dept_store_id (number) , dept_store_chain_id (number) , store_name (text) , store_address (text) , store_phone (text) , store_email (text) | departments : department_id (number) , dept_store_id (number) , department_name (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) | product_suppliers : product_id (number) , supplier_id (number) , date_supplied_from (time) , date_supplied_to (time) , total_amount_purchased (text) , total_value_purchased (number) | staff_department_assignments : staff_id (number) , department_id (number) , date_assigned_from (time) , job_title_code (text) , date_assigned_to (time)

customers : customer_name (text) , customer_id (number) , customer_address (text)


Question: Return the names and ids of customers who have TN in their address.

addresses : address_id (number) , address_details (text) | staff : staff_id (number) , staff_gender (text) , staff_name (text) | suppliers : supplier_id (number) , supplier_name (text) , supplier_phone (text) | department_store_chain : dept_store_chain_id (number) , dept_store_chain_name (text) | customers : customer_id (number) , payment_method_code (text) , customer_code (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | supplier_addresses : supplier_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_addresses : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_status_code (text) , order_date (time) | department_stores : dept_store_id (number) , dept_store_chain_id (number) , store_name (text) , store_address (text) , store_phone (text) , store_email (text) | departments : department_id (number) , dept_store_id (number) , department_name (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) | product_suppliers : product_id (number) , supplier_id (number) , date_supplied_from (time) , date_supplied_to (time) , total_amount_purchased (text) , total_value_purchased (number) | staff_department_assignments : staff_id (number) , department_id (number) , date_assigned_from (time) , job_title_code (text) , date_assigned_to (time)

customers : customer_name (text) , customer_id (number) , customer_address (text)


Question: Return the name and gender of the staff who was assigned in 2016.

addresses : address_id (number) , address_details (text) | staff : staff_id (number) , staff_gender (text) , staff_name (text) | suppliers : supplier_id (number) , supplier_name (text) , supplier_phone (text) | department_store_chain : dept_store_chain_id (number) , dept_store_chain_name (text) | customers : customer_id (number) , payment_method_code (text) , customer_code (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | supplier_addresses : supplier_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_addresses : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_status_code (text) , order_date (time) | department_stores : dept_store_id (number) , dept_store_chain_id (number) , store_name (text) , store_address (text) , store_phone (text) , store_email (text) | departments : department_id (number) , dept_store_id (number) , department_name (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) | product_suppliers : product_id (number) , supplier_id (number) , date_supplied_from (time) , date_supplied_to (time) , total_amount_purchased (text) , total_value_purchased (number) | staff_department_assignments : staff_id (number) , department_id (number) , date_assigned_from (time) , job_title_code (text) , date_assigned_to (time)

staff : staff_name (text) , staff_gender (text) , staff_id (number) | staff_department_assignments : staff_id (number) , date_assigned_from (time)


Question: What are the names and genders of staff who were assigned in 2016?

addresses : address_id (number) , address_details (text) | staff : staff_id (number) , staff_gender (text) , staff_name (text) | suppliers : supplier_id (number) , supplier_name (text) , supplier_phone (text) | department_store_chain : dept_store_chain_id (number) , dept_store_chain_name (text) | customers : customer_id (number) , payment_method_code (text) , customer_code (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | supplier_addresses : supplier_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_addresses : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_status_code (text) , order_date (time) | department_stores : dept_store_id (number) , dept_store_chain_id (number) , store_name (text) , store_address (text) , store_phone (text) , store_email (text) | departments : department_id (number) , dept_store_id (number) , department_name (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) | product_suppliers : product_id (number) , supplier_id (number) , date_supplied_from (time) , date_supplied_to (time) , total_amount_purchased (text) , total_value_purchased (number) | staff_department_assignments : staff_id (number) , department_id (number) , date_assigned_from (time) , job_title_code (text) , date_assigned_to (time)

staff : staff_name (text) , staff_gender (text) , staff_id (number) | staff_department_assignments : staff_id (number) , date_assigned_from (time)


Question: List the name of staff who has been assigned multiple jobs.

addresses : address_id (number) , address_details (text) | staff : staff_id (number) , staff_gender (text) , staff_name (text) | suppliers : supplier_id (number) , supplier_name (text) , supplier_phone (text) | department_store_chain : dept_store_chain_id (number) , dept_store_chain_name (text) | customers : customer_id (number) , payment_method_code (text) , customer_code (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | supplier_addresses : supplier_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_addresses : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_status_code (text) , order_date (time) | department_stores : dept_store_id (number) , dept_store_chain_id (number) , store_name (text) , store_address (text) , store_phone (text) , store_email (text) | departments : department_id (number) , dept_store_id (number) , department_name (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) | product_suppliers : product_id (number) , supplier_id (number) , date_supplied_from (time) , date_supplied_to (time) , total_amount_purchased (text) , total_value_purchased (number) | staff_department_assignments : staff_id (number) , department_id (number) , date_assigned_from (time) , job_title_code (text) , date_assigned_to (time)

staff : staff_name (text) , staff_id (number) | staff_department_assignments : staff_id (number)


Question: What are the names of staff who have been assigned multiple jobs?

addresses : address_id (number) , address_details (text) | staff : staff_id (number) , staff_gender (text) , staff_name (text) | suppliers : supplier_id (number) , supplier_name (text) , supplier_phone (text) | department_store_chain : dept_store_chain_id (number) , dept_store_chain_name (text) | customers : customer_id (number) , payment_method_code (text) , customer_code (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | supplier_addresses : supplier_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_addresses : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_status_code (text) , order_date (time) | department_stores : dept_store_id (number) , dept_store_chain_id (number) , store_name (text) , store_address (text) , store_phone (text) , store_email (text) | departments : department_id (number) , dept_store_id (number) , department_name (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) | product_suppliers : product_id (number) , supplier_id (number) , date_supplied_from (time) , date_supplied_to (time) , total_amount_purchased (text) , total_value_purchased (number) | staff_department_assignments : staff_id (number) , department_id (number) , date_assigned_from (time) , job_title_code (text) , date_assigned_to (time)

staff : staff_name (text) , staff_id (number) | staff_department_assignments : staff_id (number)


Question: List the name and phone number of all suppliers in the alphabetical order of their addresses.

addresses : address_id (number) , address_details (text) | staff : staff_id (number) , staff_gender (text) , staff_name (text) | suppliers : supplier_id (number) , supplier_name (text) , supplier_phone (text) | department_store_chain : dept_store_chain_id (number) , dept_store_chain_name (text) | customers : customer_id (number) , payment_method_code (text) , customer_code (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | supplier_addresses : supplier_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_addresses : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_status_code (text) , order_date (time) | department_stores : dept_store_id (number) , dept_store_chain_id (number) , store_name (text) , store_address (text) , store_phone (text) , store_email (text) | departments : department_id (number) , dept_store_id (number) , department_name (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) | product_suppliers : product_id (number) , supplier_id (number) , date_supplied_from (time) , date_supplied_to (time) , total_amount_purchased (text) , total_value_purchased (number) | staff_department_assignments : staff_id (number) , department_id (number) , date_assigned_from (time) , job_title_code (text) , date_assigned_to (time)

suppliers : supplier_name (text) , supplier_phone (text) , supplier_id (number) | supplier_addresses : supplier_id (number) , address_id (number) | addresses : address_id (number) , address_details (text)


Question: What are the names and phone numbers for all suppliers, sorted in alphabetical order of their addressed?

addresses : address_id (number) , address_details (text) | staff : staff_id (number) , staff_gender (text) , staff_name (text) | suppliers : supplier_id (number) , supplier_name (text) , supplier_phone (text) | department_store_chain : dept_store_chain_id (number) , dept_store_chain_name (text) | customers : customer_id (number) , payment_method_code (text) , customer_code (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | supplier_addresses : supplier_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_addresses : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_status_code (text) , order_date (time) | department_stores : dept_store_id (number) , dept_store_chain_id (number) , store_name (text) , store_address (text) , store_phone (text) , store_email (text) | departments : department_id (number) , dept_store_id (number) , department_name (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) | product_suppliers : product_id (number) , supplier_id (number) , date_supplied_from (time) , date_supplied_to (time) , total_amount_purchased (text) , total_value_purchased (number) | staff_department_assignments : staff_id (number) , department_id (number) , date_assigned_from (time) , job_title_code (text) , date_assigned_to (time)

suppliers : supplier_name (text) , supplier_phone (text) , supplier_id (number) | supplier_addresses : supplier_id (number) , address_id (number) | addresses : address_id (number) , address_details (text)


Question: What are the phone numbers of all customers and suppliers.

addresses : address_id (number) , address_details (text) | staff : staff_id (number) , staff_gender (text) , staff_name (text) | suppliers : supplier_id (number) , supplier_name (text) , supplier_phone (text) | department_store_chain : dept_store_chain_id (number) , dept_store_chain_name (text) | customers : customer_id (number) , payment_method_code (text) , customer_code (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | supplier_addresses : supplier_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_addresses : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_status_code (text) , order_date (time) | department_stores : dept_store_id (number) , dept_store_chain_id (number) , store_name (text) , store_address (text) , store_phone (text) , store_email (text) | departments : department_id (number) , dept_store_id (number) , department_name (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) | product_suppliers : product_id (number) , supplier_id (number) , date_supplied_from (time) , date_supplied_to (time) , total_amount_purchased (text) , total_value_purchased (number) | staff_department_assignments : staff_id (number) , department_id (number) , date_assigned_from (time) , job_title_code (text) , date_assigned_to (time)

customers : customer_phone (text) | suppliers : supplier_phone (text)


Question: Return the phone numbers for all customers and suppliers.

addresses : address_id (number) , address_details (text) | staff : staff_id (number) , staff_gender (text) , staff_name (text) | suppliers : supplier_id (number) , supplier_name (text) , supplier_phone (text) | department_store_chain : dept_store_chain_id (number) , dept_store_chain_name (text) | customers : customer_id (number) , payment_method_code (text) , customer_code (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | supplier_addresses : supplier_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_addresses : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_status_code (text) , order_date (time) | department_stores : dept_store_id (number) , dept_store_chain_id (number) , store_name (text) , store_address (text) , store_phone (text) , store_email (text) | departments : department_id (number) , dept_store_id (number) , department_name (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) | product_suppliers : product_id (number) , supplier_id (number) , date_supplied_from (time) , date_supplied_to (time) , total_amount_purchased (text) , total_value_purchased (number) | staff_department_assignments : staff_id (number) , department_id (number) , date_assigned_from (time) , job_title_code (text) , date_assigned_to (time)

customers : customer_phone (text) | suppliers : supplier_phone (text)


Question: Return the ids of all products that were ordered more than three times or supplied more than 80000.

addresses : address_id (number) , address_details (text) | staff : staff_id (number) , staff_gender (text) , staff_name (text) | suppliers : supplier_id (number) , supplier_name (text) , supplier_phone (text) | department_store_chain : dept_store_chain_id (number) , dept_store_chain_name (text) | customers : customer_id (number) , payment_method_code (text) , customer_code (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | supplier_addresses : supplier_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_addresses : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_status_code (text) , order_date (time) | department_stores : dept_store_id (number) , dept_store_chain_id (number) , store_name (text) , store_address (text) , store_phone (text) , store_email (text) | departments : department_id (number) , dept_store_id (number) , department_name (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) | product_suppliers : product_id (number) , supplier_id (number) , date_supplied_from (time) , date_supplied_to (time) , total_amount_purchased (text) , total_value_purchased (number) | staff_department_assignments : staff_id (number) , department_id (number) , date_assigned_from (time) , job_title_code (text) , date_assigned_to (time)

order_items : product_id (number) , order_item_id (number) | product_suppliers : product_id (number) , total_amount_purchased (text)


Question: What are the ids of all products that were either ordered more than 3 times or have a cumulative amount purchased of above 80000?

addresses : address_id (number) , address_details (text) | staff : staff_id (number) , staff_gender (text) , staff_name (text) | suppliers : supplier_id (number) , supplier_name (text) , supplier_phone (text) | department_store_chain : dept_store_chain_id (number) , dept_store_chain_name (text) | customers : customer_id (number) , payment_method_code (text) , customer_code (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | supplier_addresses : supplier_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_addresses : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_status_code (text) , order_date (time) | department_stores : dept_store_id (number) , dept_store_chain_id (number) , store_name (text) , store_address (text) , store_phone (text) , store_email (text) | departments : department_id (number) , dept_store_id (number) , department_name (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) | product_suppliers : product_id (number) , supplier_id (number) , date_supplied_from (time) , date_supplied_to (time) , total_amount_purchased (text) , total_value_purchased (number) | staff_department_assignments : staff_id (number) , department_id (number) , date_assigned_from (time) , job_title_code (text) , date_assigned_to (time)

order_items : product_id (number) , order_item_id (number) | product_suppliers : product_id (number) , total_amount_purchased (text)


Question: What are id and name of the products whose price is lower than 600 or higher than 900?

addresses : address_id (number) , address_details (text) | staff : staff_id (number) , staff_gender (text) , staff_name (text) | suppliers : supplier_id (number) , supplier_name (text) , supplier_phone (text) | department_store_chain : dept_store_chain_id (number) , dept_store_chain_name (text) | customers : customer_id (number) , payment_method_code (text) , customer_code (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | supplier_addresses : supplier_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_addresses : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_status_code (text) , order_date (time) | department_stores : dept_store_id (number) , dept_store_chain_id (number) , store_name (text) , store_address (text) , store_phone (text) , store_email (text) | departments : department_id (number) , dept_store_id (number) , department_name (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) | product_suppliers : product_id (number) , supplier_id (number) , date_supplied_from (time) , date_supplied_to (time) , total_amount_purchased (text) , total_value_purchased (number) | staff_department_assignments : staff_id (number) , department_id (number) , date_assigned_from (time) , job_title_code (text) , date_assigned_to (time)

products : product_id (number) , product_name (text) , product_price (number)


Question: Give the ids and names of products with price lower than 600 or higher than 900.

addresses : address_id (number) , address_details (text) | staff : staff_id (number) , staff_gender (text) , staff_name (text) | suppliers : supplier_id (number) , supplier_name (text) , supplier_phone (text) | department_store_chain : dept_store_chain_id (number) , dept_store_chain_name (text) | customers : customer_id (number) , payment_method_code (text) , customer_code (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | supplier_addresses : supplier_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_addresses : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_status_code (text) , order_date (time) | department_stores : dept_store_id (number) , dept_store_chain_id (number) , store_name (text) , store_address (text) , store_phone (text) , store_email (text) | departments : department_id (number) , dept_store_id (number) , department_name (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) | product_suppliers : product_id (number) , supplier_id (number) , date_supplied_from (time) , date_supplied_to (time) , total_amount_purchased (text) , total_value_purchased (number) | staff_department_assignments : staff_id (number) , department_id (number) , date_assigned_from (time) , job_title_code (text) , date_assigned_to (time)

products : product_id (number) , product_name (text) , product_price (number)


Question: Find the id of suppliers whose average amount purchased for each product is above 50000 or below 30000.

addresses : address_id (number) , address_details (text) | staff : staff_id (number) , staff_gender (text) , staff_name (text) | suppliers : supplier_id (number) , supplier_name (text) , supplier_phone (text) | department_store_chain : dept_store_chain_id (number) , dept_store_chain_name (text) | customers : customer_id (number) , payment_method_code (text) , customer_code (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | supplier_addresses : supplier_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_addresses : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_status_code (text) , order_date (time) | department_stores : dept_store_id (number) , dept_store_chain_id (number) , store_name (text) , store_address (text) , store_phone (text) , store_email (text) | departments : department_id (number) , dept_store_id (number) , department_name (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) | product_suppliers : product_id (number) , supplier_id (number) , date_supplied_from (time) , date_supplied_to (time) , total_amount_purchased (text) , total_value_purchased (number) | staff_department_assignments : staff_id (number) , department_id (number) , date_assigned_from (time) , job_title_code (text) , date_assigned_to (time)

product_suppliers : supplier_id (number) , total_amount_purchased (text)


Question: What are the ids of suppliers which have an average amount purchased of above 50000 or below 30000?

addresses : address_id (number) , address_details (text) | staff : staff_id (number) , staff_gender (text) , staff_name (text) | suppliers : supplier_id (number) , supplier_name (text) , supplier_phone (text) | department_store_chain : dept_store_chain_id (number) , dept_store_chain_name (text) | customers : customer_id (number) , payment_method_code (text) , customer_code (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | supplier_addresses : supplier_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_addresses : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_status_code (text) , order_date (time) | department_stores : dept_store_id (number) , dept_store_chain_id (number) , store_name (text) , store_address (text) , store_phone (text) , store_email (text) | departments : department_id (number) , dept_store_id (number) , department_name (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) | product_suppliers : product_id (number) , supplier_id (number) , date_supplied_from (time) , date_supplied_to (time) , total_amount_purchased (text) , total_value_purchased (number) | staff_department_assignments : staff_id (number) , department_id (number) , date_assigned_from (time) , job_title_code (text) , date_assigned_to (time)

product_suppliers : supplier_id (number) , total_amount_purchased (text)


Question: What are the average amount purchased and value purchased for the supplier who supplies the most products.

addresses : address_id (number) , address_details (text) | staff : staff_id (number) , staff_gender (text) , staff_name (text) | suppliers : supplier_id (number) , supplier_name (text) , supplier_phone (text) | department_store_chain : dept_store_chain_id (number) , dept_store_chain_name (text) | customers : customer_id (number) , payment_method_code (text) , customer_code (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | supplier_addresses : supplier_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_addresses : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_status_code (text) , order_date (time) | department_stores : dept_store_id (number) , dept_store_chain_id (number) , store_name (text) , store_address (text) , store_phone (text) , store_email (text) | departments : department_id (number) , dept_store_id (number) , department_name (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) | product_suppliers : product_id (number) , supplier_id (number) , date_supplied_from (time) , date_supplied_to (time) , total_amount_purchased (text) , total_value_purchased (number) | staff_department_assignments : staff_id (number) , department_id (number) , date_assigned_from (time) , job_title_code (text) , date_assigned_to (time)

product_suppliers : total_amount_purchased (text) , total_value_purchased (number) , supplier_id (number) , product_id (number)


Question: Return the average total amount purchased and total value purchased for the supplier who supplies the greatest number of products.

addresses : address_id (number) , address_details (text) | staff : staff_id (number) , staff_gender (text) , staff_name (text) | suppliers : supplier_id (number) , supplier_name (text) , supplier_phone (text) | department_store_chain : dept_store_chain_id (number) , dept_store_chain_name (text) | customers : customer_id (number) , payment_method_code (text) , customer_code (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | supplier_addresses : supplier_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_addresses : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_status_code (text) , order_date (time) | department_stores : dept_store_id (number) , dept_store_chain_id (number) , store_name (text) , store_address (text) , store_phone (text) , store_email (text) | departments : department_id (number) , dept_store_id (number) , department_name (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) | product_suppliers : product_id (number) , supplier_id (number) , date_supplied_from (time) , date_supplied_to (time) , total_amount_purchased (text) , total_value_purchased (number) | staff_department_assignments : staff_id (number) , department_id (number) , date_assigned_from (time) , job_title_code (text) , date_assigned_to (time)

product_suppliers : total_amount_purchased (text) , total_value_purchased (number) , supplier_id (number) , product_id (number)


Question: What is the largest and smallest customer codes?

addresses : address_id (number) , address_details (text) | staff : staff_id (number) , staff_gender (text) , staff_name (text) | suppliers : supplier_id (number) , supplier_name (text) , supplier_phone (text) | department_store_chain : dept_store_chain_id (number) , dept_store_chain_name (text) | customers : customer_id (number) , payment_method_code (text) , customer_code (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | supplier_addresses : supplier_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_addresses : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_status_code (text) , order_date (time) | department_stores : dept_store_id (number) , dept_store_chain_id (number) , store_name (text) , store_address (text) , store_phone (text) , store_email (text) | departments : department_id (number) , dept_store_id (number) , department_name (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) | product_suppliers : product_id (number) , supplier_id (number) , date_supplied_from (time) , date_supplied_to (time) , total_amount_purchased (text) , total_value_purchased (number) | staff_department_assignments : staff_id (number) , department_id (number) , date_assigned_from (time) , job_title_code (text) , date_assigned_to (time)


Question: Return the maximum and minimum customer codes.

addresses : address_id (number) , address_details (text) | staff : staff_id (number) , staff_gender (text) , staff_name (text) | suppliers : supplier_id (number) , supplier_name (text) , supplier_phone (text) | department_store_chain : dept_store_chain_id (number) , dept_store_chain_name (text) | customers : customer_id (number) , payment_method_code (text) , customer_code (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | supplier_addresses : supplier_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_addresses : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_status_code (text) , order_date (time) | department_stores : dept_store_id (number) , dept_store_chain_id (number) , store_name (text) , store_address (text) , store_phone (text) , store_email (text) | departments : department_id (number) , dept_store_id (number) , department_name (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) | product_suppliers : product_id (number) , supplier_id (number) , date_supplied_from (time) , date_supplied_to (time) , total_amount_purchased (text) , total_value_purchased (number) | staff_department_assignments : staff_id (number) , department_id (number) , date_assigned_from (time) , job_title_code (text) , date_assigned_to (time)


Question: List the names of all the distinct customers who bought a keyboard.

addresses : address_id (number) , address_details (text) | staff : staff_id (number) , staff_gender (text) , staff_name (text) | suppliers : supplier_id (number) , supplier_name (text) , supplier_phone (text) | department_store_chain : dept_store_chain_id (number) , dept_store_chain_name (text) | customers : customer_id (number) , payment_method_code (text) , customer_code (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | supplier_addresses : supplier_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_addresses : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_status_code (text) , order_date (time) | department_stores : dept_store_id (number) , dept_store_chain_id (number) , store_name (text) , store_address (text) , store_phone (text) , store_email (text) | departments : department_id (number) , dept_store_id (number) , department_name (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) | product_suppliers : product_id (number) , supplier_id (number) , date_supplied_from (time) , date_supplied_to (time) , total_amount_purchased (text) , total_value_purchased (number) | staff_department_assignments : staff_id (number) , department_id (number) , date_assigned_from (time) , job_title_code (text) , date_assigned_to (time)

customers : customer_name (text) , customer_id (number) | customer_orders : customer_id (number) , order_id (number) | order_items : order_id (number) , product_id (number) | products : product_id (number) , product_name (text)


Question: What are the distinct names of customers who have purchased a keyboard?

addresses : address_id (number) , address_details (text) | staff : staff_id (number) , staff_gender (text) , staff_name (text) | suppliers : supplier_id (number) , supplier_name (text) , supplier_phone (text) | department_store_chain : dept_store_chain_id (number) , dept_store_chain_name (text) | customers : customer_id (number) , payment_method_code (text) , customer_code (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | supplier_addresses : supplier_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_addresses : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_status_code (text) , order_date (time) | department_stores : dept_store_id (number) , dept_store_chain_id (number) , store_name (text) , store_address (text) , store_phone (text) , store_email (text) | departments : department_id (number) , dept_store_id (number) , department_name (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) | product_suppliers : product_id (number) , supplier_id (number) , date_supplied_from (time) , date_supplied_to (time) , total_amount_purchased (text) , total_value_purchased (number) | staff_department_assignments : staff_id (number) , department_id (number) , date_assigned_from (time) , job_title_code (text) , date_assigned_to (time)

customers : customer_name (text) , customer_id (number) | customer_orders : customer_id (number) , order_id (number) | order_items : order_id (number) , product_id (number) | products : product_id (number) , product_name (text)


Question: List the names and phone numbers of all the distinct suppliers who supply red jeans.

addresses : address_id (number) , address_details (text) | staff : staff_id (number) , staff_gender (text) , staff_name (text) | suppliers : supplier_id (number) , supplier_name (text) , supplier_phone (text) | department_store_chain : dept_store_chain_id (number) , dept_store_chain_name (text) | customers : customer_id (number) , payment_method_code (text) , customer_code (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | supplier_addresses : supplier_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_addresses : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_status_code (text) , order_date (time) | department_stores : dept_store_id (number) , dept_store_chain_id (number) , store_name (text) , store_address (text) , store_phone (text) , store_email (text) | departments : department_id (number) , dept_store_id (number) , department_name (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) | product_suppliers : product_id (number) , supplier_id (number) , date_supplied_from (time) , date_supplied_to (time) , total_amount_purchased (text) , total_value_purchased (number) | staff_department_assignments : staff_id (number) , department_id (number) , date_assigned_from (time) , job_title_code (text) , date_assigned_to (time)

suppliers : supplier_name (text) , supplier_phone (text) , supplier_id (number) | product_suppliers : supplier_id (number) , product_id (number) | products : product_id (number) , product_name (text)


Question: What are the distinct names and phone numbers for suppliers who have red jeans?

addresses : address_id (number) , address_details (text) | staff : staff_id (number) , staff_gender (text) , staff_name (text) | suppliers : supplier_id (number) , supplier_name (text) , supplier_phone (text) | department_store_chain : dept_store_chain_id (number) , dept_store_chain_name (text) | customers : customer_id (number) , payment_method_code (text) , customer_code (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | supplier_addresses : supplier_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_addresses : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_status_code (text) , order_date (time) | department_stores : dept_store_id (number) , dept_store_chain_id (number) , store_name (text) , store_address (text) , store_phone (text) , store_email (text) | departments : department_id (number) , dept_store_id (number) , department_name (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) | product_suppliers : product_id (number) , supplier_id (number) , date_supplied_from (time) , date_supplied_to (time) , total_amount_purchased (text) , total_value_purchased (number) | staff_department_assignments : staff_id (number) , department_id (number) , date_assigned_from (time) , job_title_code (text) , date_assigned_to (time)

suppliers : supplier_name (text) , supplier_phone (text) , supplier_id (number) | product_suppliers : supplier_id (number) , product_id (number) | products : product_id (number) , product_name (text)


Question: What are the highest and lowest prices of products, grouped by and alphabetically ordered by product type?

addresses : address_id (number) , address_details (text) | staff : staff_id (number) , staff_gender (text) , staff_name (text) | suppliers : supplier_id (number) , supplier_name (text) , supplier_phone (text) | department_store_chain : dept_store_chain_id (number) , dept_store_chain_name (text) | customers : customer_id (number) , payment_method_code (text) , customer_code (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | supplier_addresses : supplier_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_addresses : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_status_code (text) , order_date (time) | department_stores : dept_store_id (number) , dept_store_chain_id (number) , store_name (text) , store_address (text) , store_phone (text) , store_email (text) | departments : department_id (number) , dept_store_id (number) , department_name (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) | product_suppliers : product_id (number) , supplier_id (number) , date_supplied_from (time) , date_supplied_to (time) , total_amount_purchased (text) , total_value_purchased (number) | staff_department_assignments : staff_id (number) , department_id (number) , date_assigned_from (time) , job_title_code (text) , date_assigned_to (time)

products : product_price (number) , product_type_code (text)


Question: Give the maximum and minimum product prices for each product type, grouped and ordered by product type.

addresses : address_id (number) , address_details (text) | staff : staff_id (number) , staff_gender (text) , staff_name (text) | suppliers : supplier_id (number) , supplier_name (text) , supplier_phone (text) | department_store_chain : dept_store_chain_id (number) , dept_store_chain_name (text) | customers : customer_id (number) , payment_method_code (text) , customer_code (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | supplier_addresses : supplier_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_addresses : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_status_code (text) , order_date (time) | department_stores : dept_store_id (number) , dept_store_chain_id (number) , store_name (text) , store_address (text) , store_phone (text) , store_email (text) | departments : department_id (number) , dept_store_id (number) , department_name (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) | product_suppliers : product_id (number) , supplier_id (number) , date_supplied_from (time) , date_supplied_to (time) , total_amount_purchased (text) , total_value_purchased (number) | staff_department_assignments : staff_id (number) , department_id (number) , date_assigned_from (time) , job_title_code (text) , date_assigned_to (time)

products : product_price (number) , product_type_code (text)


Question: List the order id, customer id for orders in Cancelled status, ordered by their order dates.

addresses : address_id (number) , address_details (text) | staff : staff_id (number) , staff_gender (text) , staff_name (text) | suppliers : supplier_id (number) , supplier_name (text) , supplier_phone (text) | department_store_chain : dept_store_chain_id (number) , dept_store_chain_name (text) | customers : customer_id (number) , payment_method_code (text) , customer_code (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | supplier_addresses : supplier_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_addresses : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_status_code (text) , order_date (time) | department_stores : dept_store_id (number) , dept_store_chain_id (number) , store_name (text) , store_address (text) , store_phone (text) , store_email (text) | departments : department_id (number) , dept_store_id (number) , department_name (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) | product_suppliers : product_id (number) , supplier_id (number) , date_supplied_from (time) , date_supplied_to (time) , total_amount_purchased (text) , total_value_purchased (number) | staff_department_assignments : staff_id (number) , department_id (number) , date_assigned_from (time) , job_title_code (text) , date_assigned_to (time)


Question: What are the order ids and customer ids for orders that have been Cancelled, sorted by their order dates?

addresses : address_id (number) , address_details (text) | staff : staff_id (number) , staff_gender (text) , staff_name (text) | suppliers : supplier_id (number) , supplier_name (text) , supplier_phone (text) | department_store_chain : dept_store_chain_id (number) , dept_store_chain_name (text) | customers : customer_id (number) , payment_method_code (text) , customer_code (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | supplier_addresses : supplier_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_addresses : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_status_code (text) , order_date (time) | department_stores : dept_store_id (number) , dept_store_chain_id (number) , store_name (text) , store_address (text) , store_phone (text) , store_email (text) | departments : department_id (number) , dept_store_id (number) , department_name (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) | product_suppliers : product_id (number) , supplier_id (number) , date_supplied_from (time) , date_supplied_to (time) , total_amount_purchased (text) , total_value_purchased (number) | staff_department_assignments : staff_id (number) , department_id (number) , date_assigned_from (time) , job_title_code (text) , date_assigned_to (time)


Question: Find the names of products that were bought by at least two distinct customers.

addresses : address_id (number) , address_details (text) | staff : staff_id (number) , staff_gender (text) , staff_name (text) | suppliers : supplier_id (number) , supplier_name (text) , supplier_phone (text) | department_store_chain : dept_store_chain_id (number) , dept_store_chain_name (text) | customers : customer_id (number) , payment_method_code (text) , customer_code (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | supplier_addresses : supplier_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_addresses : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_status_code (text) , order_date (time) | department_stores : dept_store_id (number) , dept_store_chain_id (number) , store_name (text) , store_address (text) , store_phone (text) , store_email (text) | departments : department_id (number) , dept_store_id (number) , department_name (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) | product_suppliers : product_id (number) , supplier_id (number) , date_supplied_from (time) , date_supplied_to (time) , total_amount_purchased (text) , total_value_purchased (number) | staff_department_assignments : staff_id (number) , department_id (number) , date_assigned_from (time) , job_title_code (text) , date_assigned_to (time)

products : product_name (text) , product_id (number) | customer_orders : order_id (number) , customer_id (number) | order_items : order_id (number) , product_id (number)


Question: What are the distinct names of products purchased by at least two different customers?

addresses : address_id (number) , address_details (text) | staff : staff_id (number) , staff_gender (text) , staff_name (text) | suppliers : supplier_id (number) , supplier_name (text) , supplier_phone (text) | department_store_chain : dept_store_chain_id (number) , dept_store_chain_name (text) | customers : customer_id (number) , payment_method_code (text) , customer_code (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | supplier_addresses : supplier_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_addresses : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_status_code (text) , order_date (time) | department_stores : dept_store_id (number) , dept_store_chain_id (number) , store_name (text) , store_address (text) , store_phone (text) , store_email (text) | departments : department_id (number) , dept_store_id (number) , department_name (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) | product_suppliers : product_id (number) , supplier_id (number) , date_supplied_from (time) , date_supplied_to (time) , total_amount_purchased (text) , total_value_purchased (number) | staff_department_assignments : staff_id (number) , department_id (number) , date_assigned_from (time) , job_title_code (text) , date_assigned_to (time)

products : product_name (text) , product_id (number) | customer_orders : order_id (number) , customer_id (number) | order_items : order_id (number) , product_id (number)


Question: Find the names of customers who have bought by at least three distinct products.

addresses : address_id (number) , address_details (text) | staff : staff_id (number) , staff_gender (text) , staff_name (text) | suppliers : supplier_id (number) , supplier_name (text) , supplier_phone (text) | department_store_chain : dept_store_chain_id (number) , dept_store_chain_name (text) | customers : customer_id (number) , payment_method_code (text) , customer_code (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | supplier_addresses : supplier_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_addresses : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_status_code (text) , order_date (time) | department_stores : dept_store_id (number) , dept_store_chain_id (number) , store_name (text) , store_address (text) , store_phone (text) , store_email (text) | departments : department_id (number) , dept_store_id (number) , department_name (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) | product_suppliers : product_id (number) , supplier_id (number) , date_supplied_from (time) , date_supplied_to (time) , total_amount_purchased (text) , total_value_purchased (number) | staff_department_assignments : staff_id (number) , department_id (number) , date_assigned_from (time) , job_title_code (text) , date_assigned_to (time)

customers : customer_name (text) , customer_id (number) | customer_orders : customer_id (number) , order_id (number) | order_items : order_id (number) , product_id (number)


Question: What are the distinct names of customers who have purchased at least three different products?

addresses : address_id (number) , address_details (text) | staff : staff_id (number) , staff_gender (text) , staff_name (text) | suppliers : supplier_id (number) , supplier_name (text) , supplier_phone (text) | department_store_chain : dept_store_chain_id (number) , dept_store_chain_name (text) | customers : customer_id (number) , payment_method_code (text) , customer_code (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | supplier_addresses : supplier_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_addresses : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_status_code (text) , order_date (time) | department_stores : dept_store_id (number) , dept_store_chain_id (number) , store_name (text) , store_address (text) , store_phone (text) , store_email (text) | departments : department_id (number) , dept_store_id (number) , department_name (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) | product_suppliers : product_id (number) , supplier_id (number) , date_supplied_from (time) , date_supplied_to (time) , total_amount_purchased (text) , total_value_purchased (number) | staff_department_assignments : staff_id (number) , department_id (number) , date_assigned_from (time) , job_title_code (text) , date_assigned_to (time)

customers : customer_name (text) , customer_id (number) | customer_orders : customer_id (number) , order_id (number) | order_items : order_id (number) , product_id (number)


Question: Find the name and gender of the staff who has been assigned the job of Sales Person but never Clerical Staff.

addresses : address_id (number) , address_details (text) | staff : staff_id (number) , staff_gender (text) , staff_name (text) | suppliers : supplier_id (number) , supplier_name (text) , supplier_phone (text) | department_store_chain : dept_store_chain_id (number) , dept_store_chain_name (text) | customers : customer_id (number) , payment_method_code (text) , customer_code (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | supplier_addresses : supplier_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_addresses : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_status_code (text) , order_date (time) | department_stores : dept_store_id (number) , dept_store_chain_id (number) , store_name (text) , store_address (text) , store_phone (text) , store_email (text) | departments : department_id (number) , dept_store_id (number) , department_name (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) | product_suppliers : product_id (number) , supplier_id (number) , date_supplied_from (time) , date_supplied_to (time) , total_amount_purchased (text) , total_value_purchased (number) | staff_department_assignments : staff_id (number) , department_id (number) , date_assigned_from (time) , job_title_code (text) , date_assigned_to (time)

staff : staff_name (text) , staff_gender (text) , staff_id (number) | staff_department_assignments : staff_id (number) , job_title_code (text)


Question: What are the names and genders of staff who have held the title Sales Person, but never Clerical Staff?

addresses : address_id (number) , address_details (text) | staff : staff_id (number) , staff_gender (text) , staff_name (text) | suppliers : supplier_id (number) , supplier_name (text) , supplier_phone (text) | department_store_chain : dept_store_chain_id (number) , dept_store_chain_name (text) | customers : customer_id (number) , payment_method_code (text) , customer_code (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | supplier_addresses : supplier_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_addresses : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_status_code (text) , order_date (time) | department_stores : dept_store_id (number) , dept_store_chain_id (number) , store_name (text) , store_address (text) , store_phone (text) , store_email (text) | departments : department_id (number) , dept_store_id (number) , department_name (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) | product_suppliers : product_id (number) , supplier_id (number) , date_supplied_from (time) , date_supplied_to (time) , total_amount_purchased (text) , total_value_purchased (number) | staff_department_assignments : staff_id (number) , department_id (number) , date_assigned_from (time) , job_title_code (text) , date_assigned_to (time)

staff : staff_name (text) , staff_gender (text) , staff_id (number) | staff_department_assignments : staff_id (number) , job_title_code (text)


Question: Find the id and name of customers whose address contains WY state and do not use credit card for payment.

addresses : address_id (number) , address_details (text) | staff : staff_id (number) , staff_gender (text) , staff_name (text) | suppliers : supplier_id (number) , supplier_name (text) , supplier_phone (text) | department_store_chain : dept_store_chain_id (number) , dept_store_chain_name (text) | customers : customer_id (number) , payment_method_code (text) , customer_code (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | supplier_addresses : supplier_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_addresses : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_status_code (text) , order_date (time) | department_stores : dept_store_id (number) , dept_store_chain_id (number) , store_name (text) , store_address (text) , store_phone (text) , store_email (text) | departments : department_id (number) , dept_store_id (number) , department_name (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) | product_suppliers : product_id (number) , supplier_id (number) , date_supplied_from (time) , date_supplied_to (time) , total_amount_purchased (text) , total_value_purchased (number) | staff_department_assignments : staff_id (number) , department_id (number) , date_assigned_from (time) , job_title_code (text) , date_assigned_to (time)

customers : customer_id (number) , customer_name (text) , customer_address (text) , payment_method_code (text)


Question: What are the ids and names of customers with addressed that contain WY and who do not use a credit card for payment?

addresses : address_id (number) , address_details (text) | staff : staff_id (number) , staff_gender (text) , staff_name (text) | suppliers : supplier_id (number) , supplier_name (text) , supplier_phone (text) | department_store_chain : dept_store_chain_id (number) , dept_store_chain_name (text) | customers : customer_id (number) , payment_method_code (text) , customer_code (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | supplier_addresses : supplier_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_addresses : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_status_code (text) , order_date (time) | department_stores : dept_store_id (number) , dept_store_chain_id (number) , store_name (text) , store_address (text) , store_phone (text) , store_email (text) | departments : department_id (number) , dept_store_id (number) , department_name (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) | product_suppliers : product_id (number) , supplier_id (number) , date_supplied_from (time) , date_supplied_to (time) , total_amount_purchased (text) , total_value_purchased (number) | staff_department_assignments : staff_id (number) , department_id (number) , date_assigned_from (time) , job_title_code (text) , date_assigned_to (time)

customers : customer_id (number) , customer_name (text) , customer_address (text) , payment_method_code (text)


Question: Find the average price of all product clothes.

addresses : address_id (number) , address_details (text) | staff : staff_id (number) , staff_gender (text) , staff_name (text) | suppliers : supplier_id (number) , supplier_name (text) , supplier_phone (text) | department_store_chain : dept_store_chain_id (number) , dept_store_chain_name (text) | customers : customer_id (number) , payment_method_code (text) , customer_code (text) , customer_name (text) , customer_address (text) , customer_phone (text) , customer_email (text) | products : product_id (number) , product_type_code (text) , product_name (text) , product_price (number) | supplier_addresses : supplier_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_addresses : customer_id (number) , address_id (number) , date_from (time) , date_to (time) | customer_orders : order_id (number) , customer_id (number) , order_status_code (text) , order_date (time) | department_stores : dept_store_id (number) , dept_store_chain_id (number) , store_name (text) , store_address (text) , store_phone (text) , store_email (text) | departments : department_id (number) , dept_store_id (number) , department_name (text) | order_items : order_item_id (number) , order_id (number) , product_id (number) | product_suppliers : product_id (number) , supplier_id (number) , date_supplied_from (time) , date_supplied_to (time) , total_amount_purchased (text) , total_value_purchased (number) | staff_department_assignments : staff_id (number) , department_id (number) , date_assigned_from (time) , job_title_code (text) , date_assigned_to (time)

products : product_price (number) , product_type_code (text)