richardr1126/spider-context-instruct huggingface dataset:
### Instruction:

Convert text to sql: What are the distinct names of customers with an order status of Pending, sorted by customer id? | addresses : address_id , address_details | staff : staff_id , staff_gender , staff_name | suppliers : supplier_id , supplier_name , supplier_phone | department_store_chain : dept_store_chain_id , dept_store_chain_name | customers : customer_id , payment_method_code , customer_code , customer_name , customer_address , customer_phone , customer_email | products : product_id , product_type_code , product_name , product_price | supplier_addresses : supplier_id , address_id , date_from , date_to | customer_addresses : customer_id , address_id , date_from , date_to | customer_orders : order_id , customer_id , order_status_code , order_date | department_stores : dept_store_id , dept_store_chain_id , store_name , store_address , store_phone , store_email | departments : department_id , dept_store_id , department_name | order_items : order_item_id , order_id , product_id | product_suppliers : product_id , supplier_id , date_supplied_from , date_supplied_to , total_amount_purchased , total_value_purchased | staff_department_assignments : staff_id , department_id , date_assigned_from , job_title_code , date_assigned_to | supplier_addresses.supplier_id = suppliers.supplier_id | supplier_addresses.address_id = addresses.address_id | customer_addresses.customer_id = customers.customer_id | customer_addresses.address_id = addresses.address_id | customer_orders.customer_id = customers.customer_id | department_stores.dept_store_chain_id = department_store_chain.dept_store_chain_id | departments.dept_store_id = department_stores.dept_store_id | order_items.product_id = products.product_id | order_items.order_id = customer_orders.order_id | product_suppliers.product_id = products.product_id | product_suppliers.supplier_id = suppliers.supplier_id | staff_department_assignments.staff_id = staff.staff_id | staff_department_assignments.department_id = departments.department_id | 

### Response:

select distinct customers.customer_name from customers join customer_orders on customers.customer_id = customer_orders.customer_id where customer_orders.order_status_code = 'Pending' order by customer_orders.customer_id asc
### Instruction:

Convert text to sql: Find the name and address of the customers who have both New and Pending orders. | addresses : address_id , address_details | staff : staff_id , staff_gender , staff_name | suppliers : supplier_id , supplier_name , supplier_phone | department_store_chain : dept_store_chain_id , dept_store_chain_name | customers : customer_id , payment_method_code , customer_code , customer_name , customer_address , customer_phone , customer_email | products : product_id , product_type_code , product_name , product_price | supplier_addresses : supplier_id , address_id , date_from , date_to | customer_addresses : customer_id , address_id , date_from , date_to | customer_orders : order_id , customer_id , order_status_code , order_date | department_stores : dept_store_id , dept_store_chain_id , store_name , store_address , store_phone , store_email | departments : department_id , dept_store_id , department_name | order_items : order_item_id , order_id , product_id | product_suppliers : product_id , supplier_id , date_supplied_from , date_supplied_to , total_amount_purchased , total_value_purchased | staff_department_assignments : staff_id , department_id , date_assigned_from , job_title_code , date_assigned_to | supplier_addresses.supplier_id = suppliers.supplier_id | supplier_addresses.address_id = addresses.address_id | customer_addresses.customer_id = customers.customer_id | customer_addresses.address_id = addresses.address_id | customer_orders.customer_id = customers.customer_id | department_stores.dept_store_chain_id = department_store_chain.dept_store_chain_id | departments.dept_store_id = department_stores.dept_store_id | order_items.product_id = products.product_id | order_items.order_id = customer_orders.order_id | product_suppliers.product_id = products.product_id | product_suppliers.supplier_id = suppliers.supplier_id | staff_department_assignments.staff_id = staff.staff_id | staff_department_assignments.department_id = departments.department_id | 

### Response:

select customers.customer_name , customers.customer_address from customers join customer_orders on customers.customer_id = customer_orders.customer_id where customer_orders.order_status_code = 'New' intersect select customers.customer_name , customers.customer_address from customers join customer_orders on customers.customer_id = customer_orders.customer_id where customer_orders.order_status_code = 'Pending'
### Instruction:

Convert text to sql: What are the names and addressed of customers who have both New and Pending orders? | addresses : address_id , address_details | staff : staff_id , staff_gender , staff_name | suppliers : supplier_id , supplier_name , supplier_phone | department_store_chain : dept_store_chain_id , dept_store_chain_name | customers : customer_id , payment_method_code , customer_code , customer_name , customer_address , customer_phone , customer_email | products : product_id , product_type_code , product_name , product_price | supplier_addresses : supplier_id , address_id , date_from , date_to | customer_addresses : customer_id , address_id , date_from , date_to | customer_orders : order_id , customer_id , order_status_code , order_date | department_stores : dept_store_id , dept_store_chain_id , store_name , store_address , store_phone , store_email | departments : department_id , dept_store_id , department_name | order_items : order_item_id , order_id , product_id | product_suppliers : product_id , supplier_id , date_supplied_from , date_supplied_to , total_amount_purchased , total_value_purchased | staff_department_assignments : staff_id , department_id , date_assigned_from , job_title_code , date_assigned_to | supplier_addresses.supplier_id = suppliers.supplier_id | supplier_addresses.address_id = addresses.address_id | customer_addresses.customer_id = customers.customer_id | customer_addresses.address_id = addresses.address_id | customer_orders.customer_id = customers.customer_id | department_stores.dept_store_chain_id = department_store_chain.dept_store_chain_id | departments.dept_store_id = department_stores.dept_store_id | order_items.product_id = products.product_id | order_items.order_id = customer_orders.order_id | product_suppliers.product_id = products.product_id | product_suppliers.supplier_id = suppliers.supplier_id | staff_department_assignments.staff_id = staff.staff_id | staff_department_assignments.department_id = departments.department_id | 

### Response:

select customers.customer_name , customers.customer_address from customers join customer_orders on customers.customer_id = customer_orders.customer_id where customer_orders.order_status_code = 'New' intersect select customers.customer_name , customers.customer_address from customers join customer_orders on customers.customer_id = customer_orders.customer_id where customer_orders.order_status_code = 'Pending'
### Instruction:

Convert text to sql: Return ids of all the products that are supplied by supplier id 2 and are more expensive than the average price of all products. | addresses : address_id , address_details | staff : staff_id , staff_gender , staff_name | suppliers : supplier_id , supplier_name , supplier_phone | department_store_chain : dept_store_chain_id , dept_store_chain_name | customers : customer_id , payment_method_code , customer_code , customer_name , customer_address , customer_phone , customer_email | products : product_id , product_type_code , product_name , product_price | supplier_addresses : supplier_id , address_id , date_from , date_to | customer_addresses : customer_id , address_id , date_from , date_to | customer_orders : order_id , customer_id , order_status_code , order_date | department_stores : dept_store_id , dept_store_chain_id , store_name , store_address , store_phone , store_email | departments : department_id , dept_store_id , department_name | order_items : order_item_id , order_id , product_id | product_suppliers : product_id , supplier_id , date_supplied_from , date_supplied_to , total_amount_purchased , total_value_purchased | staff_department_assignments : staff_id , department_id , date_assigned_from , job_title_code , date_assigned_to | supplier_addresses.supplier_id = suppliers.supplier_id | supplier_addresses.address_id = addresses.address_id | customer_addresses.customer_id = customers.customer_id | customer_addresses.address_id = addresses.address_id | customer_orders.customer_id = customers.customer_id | department_stores.dept_store_chain_id = department_store_chain.dept_store_chain_id | departments.dept_store_id = department_stores.dept_store_id | order_items.product_id = products.product_id | order_items.order_id = customer_orders.order_id | product_suppliers.product_id = products.product_id | product_suppliers.supplier_id = suppliers.supplier_id | staff_department_assignments.staff_id = staff.staff_id | staff_department_assignments.department_id = departments.department_id | 

### Response:

select product_suppliers.product_id from product_suppliers join products on product_suppliers.product_id = products.product_id where product_suppliers.supplier_id = 2 and products.product_price > ( select avg ( product_price ) from products )
### Instruction:

Convert text to sql: 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 , address_details | staff : staff_id , staff_gender , staff_name | suppliers : supplier_id , supplier_name , supplier_phone | department_store_chain : dept_store_chain_id , dept_store_chain_name | customers : customer_id , payment_method_code , customer_code , customer_name , customer_address , customer_phone , customer_email | products : product_id , product_type_code , product_name , product_price | supplier_addresses : supplier_id , address_id , date_from , date_to | customer_addresses : customer_id , address_id , date_from , date_to | customer_orders : order_id , customer_id , order_status_code , order_date | department_stores : dept_store_id , dept_store_chain_id , store_name , store_address , store_phone , store_email | departments : department_id , dept_store_id , department_name | order_items : order_item_id , order_id , product_id | product_suppliers : product_id , supplier_id , date_supplied_from , date_supplied_to , total_amount_purchased , total_value_purchased | staff_department_assignments : staff_id , department_id , date_assigned_from , job_title_code , date_assigned_to | supplier_addresses.supplier_id = suppliers.supplier_id | supplier_addresses.address_id = addresses.address_id | customer_addresses.customer_id = customers.customer_id | customer_addresses.address_id = addresses.address_id | customer_orders.customer_id = customers.customer_id | department_stores.dept_store_chain_id = department_store_chain.dept_store_chain_id | departments.dept_store_id = department_stores.dept_store_id | order_items.product_id = products.product_id | order_items.order_id = customer_orders.order_id | product_suppliers.product_id = products.product_id | product_suppliers.supplier_id = suppliers.supplier_id | staff_department_assignments.staff_id = staff.staff_id | staff_department_assignments.department_id = departments.department_id | 

### Response:

select product_suppliers.product_id from product_suppliers join products on product_suppliers.product_id = products.product_id where product_suppliers.supplier_id = 2 and products.product_price > ( select avg ( product_price ) from products )
### Instruction:

Convert text to sql: What is the id and name of the department store that has both marketing and managing department? | addresses : address_id , address_details | staff : staff_id , staff_gender , staff_name | suppliers : supplier_id , supplier_name , supplier_phone | department_store_chain : dept_store_chain_id , dept_store_chain_name | customers : customer_id , payment_method_code , customer_code , customer_name , customer_address , customer_phone , customer_email | products : product_id , product_type_code , product_name , product_price | supplier_addresses : supplier_id , address_id , date_from , date_to | customer_addresses : customer_id , address_id , date_from , date_to | customer_orders : order_id , customer_id , order_status_code , order_date | department_stores : dept_store_id , dept_store_chain_id , store_name , store_address , store_phone , store_email | departments : department_id , dept_store_id , department_name | order_items : order_item_id , order_id , product_id | product_suppliers : product_id , supplier_id , date_supplied_from , date_supplied_to , total_amount_purchased , total_value_purchased | staff_department_assignments : staff_id , department_id , date_assigned_from , job_title_code , date_assigned_to | supplier_addresses.supplier_id = suppliers.supplier_id | supplier_addresses.address_id = addresses.address_id | customer_addresses.customer_id = customers.customer_id | customer_addresses.address_id = addresses.address_id | customer_orders.customer_id = customers.customer_id | department_stores.dept_store_chain_id = department_store_chain.dept_store_chain_id | departments.dept_store_id = department_stores.dept_store_id | order_items.product_id = products.product_id | order_items.order_id = customer_orders.order_id | product_suppliers.product_id = products.product_id | product_suppliers.supplier_id = suppliers.supplier_id | staff_department_assignments.staff_id = staff.staff_id | staff_department_assignments.department_id = departments.department_id | 

### Response:

select department_stores.dept_store_id , department_stores.store_name from departments join department_stores on departments.dept_store_id = department_stores.dept_store_id where departments.department_name = 'marketing' intersect select department_stores.dept_store_id , department_stores.store_name from departments join department_stores on departments.dept_store_id = department_stores.dept_store_id where departments.department_name = 'managing'
### Instruction:

Convert text to sql: What are the ids and names of department stores with both marketing and managing departments? | addresses : address_id , address_details | staff : staff_id , staff_gender , staff_name | suppliers : supplier_id , supplier_name , supplier_phone | department_store_chain : dept_store_chain_id , dept_store_chain_name | customers : customer_id , payment_method_code , customer_code , customer_name , customer_address , customer_phone , customer_email | products : product_id , product_type_code , product_name , product_price | supplier_addresses : supplier_id , address_id , date_from , date_to | customer_addresses : customer_id , address_id , date_from , date_to | customer_orders : order_id , customer_id , order_status_code , order_date | department_stores : dept_store_id , dept_store_chain_id , store_name , store_address , store_phone , store_email | departments : department_id , dept_store_id , department_name | order_items : order_item_id , order_id , product_id | product_suppliers : product_id , supplier_id , date_supplied_from , date_supplied_to , total_amount_purchased , total_value_purchased | staff_department_assignments : staff_id , department_id , date_assigned_from , job_title_code , date_assigned_to | supplier_addresses.supplier_id = suppliers.supplier_id | supplier_addresses.address_id = addresses.address_id | customer_addresses.customer_id = customers.customer_id | customer_addresses.address_id = addresses.address_id | customer_orders.customer_id = customers.customer_id | department_stores.dept_store_chain_id = department_store_chain.dept_store_chain_id | departments.dept_store_id = department_stores.dept_store_id | order_items.product_id = products.product_id | order_items.order_id = customer_orders.order_id | product_suppliers.product_id = products.product_id | product_suppliers.supplier_id = suppliers.supplier_id | staff_department_assignments.staff_id = staff.staff_id | staff_department_assignments.department_id = departments.department_id | 

### Response:

select department_stores.dept_store_id , department_stores.store_name from departments join department_stores on departments.dept_store_id = department_stores.dept_store_id where departments.department_name = 'marketing' intersect select department_stores.dept_store_id , department_stores.store_name from departments join department_stores on departments.dept_store_id = department_stores.dept_store_id where departments.department_name = 'managing'
### Instruction:

Convert text to sql: What are the ids of the two department store chains with the largest number of department stores? | addresses : address_id , address_details | staff : staff_id , staff_gender , staff_name | suppliers : supplier_id , supplier_name , supplier_phone | department_store_chain : dept_store_chain_id , dept_store_chain_name | customers : customer_id , payment_method_code , customer_code , customer_name , customer_address , customer_phone , customer_email | products : product_id , product_type_code , product_name , product_price | supplier_addresses : supplier_id , address_id , date_from , date_to | customer_addresses : customer_id , address_id , date_from , date_to | customer_orders : order_id , customer_id , order_status_code , order_date | department_stores : dept_store_id , dept_store_chain_id , store_name , store_address , store_phone , store_email | departments : department_id , dept_store_id , department_name | order_items : order_item_id , order_id , product_id | product_suppliers : product_id , supplier_id , date_supplied_from , date_supplied_to , total_amount_purchased , total_value_purchased | staff_department_assignments : staff_id , department_id , date_assigned_from , job_title_code , date_assigned_to | supplier_addresses.supplier_id = suppliers.supplier_id | supplier_addresses.address_id = addresses.address_id | customer_addresses.customer_id = customers.customer_id | customer_addresses.address_id = addresses.address_id | customer_orders.customer_id = customers.customer_id | department_stores.dept_store_chain_id = department_store_chain.dept_store_chain_id | departments.dept_store_id = department_stores.dept_store_id | order_items.product_id = products.product_id | order_items.order_id = customer_orders.order_id | product_suppliers.product_id = products.product_id | product_suppliers.supplier_id = suppliers.supplier_id | staff_department_assignments.staff_id = staff.staff_id | staff_department_assignments.department_id = departments.department_id | 

### Response:

select dept_store_chain_id from department_stores group by dept_store_chain_id order by count ( * ) desc limit 2
### Instruction:

Convert text to sql: Return the ids of the two department store chains with the most department stores. | addresses : address_id , address_details | staff : staff_id , staff_gender , staff_name | suppliers : supplier_id , supplier_name , supplier_phone | department_store_chain : dept_store_chain_id , dept_store_chain_name | customers : customer_id , payment_method_code , customer_code , customer_name , customer_address , customer_phone , customer_email | products : product_id , product_type_code , product_name , product_price | supplier_addresses : supplier_id , address_id , date_from , date_to | customer_addresses : customer_id , address_id , date_from , date_to | customer_orders : order_id , customer_id , order_status_code , order_date | department_stores : dept_store_id , dept_store_chain_id , store_name , store_address , store_phone , store_email | departments : department_id , dept_store_id , department_name | order_items : order_item_id , order_id , product_id | product_suppliers : product_id , supplier_id , date_supplied_from , date_supplied_to , total_amount_purchased , total_value_purchased | staff_department_assignments : staff_id , department_id , date_assigned_from , job_title_code , date_assigned_to | supplier_addresses.supplier_id = suppliers.supplier_id | supplier_addresses.address_id = addresses.address_id | customer_addresses.customer_id = customers.customer_id | customer_addresses.address_id = addresses.address_id | customer_orders.customer_id = customers.customer_id | department_stores.dept_store_chain_id = department_store_chain.dept_store_chain_id | departments.dept_store_id = department_stores.dept_store_id | order_items.product_id = products.product_id | order_items.order_id = customer_orders.order_id | product_suppliers.product_id = products.product_id | product_suppliers.supplier_id = suppliers.supplier_id | staff_department_assignments.staff_id = staff.staff_id | staff_department_assignments.department_id = departments.department_id | 

### Response:

select dept_store_chain_id from department_stores group by dept_store_chain_id order by count ( * ) desc limit 2
### Instruction:

Convert text to sql: What is the id of the department with the least number of staff? | addresses : address_id , address_details | staff : staff_id , staff_gender , staff_name | suppliers : supplier_id , supplier_name , supplier_phone | department_store_chain : dept_store_chain_id , dept_store_chain_name | customers : customer_id , payment_method_code , customer_code , customer_name , customer_address , customer_phone , customer_email | products : product_id , product_type_code , product_name , product_price | supplier_addresses : supplier_id , address_id , date_from , date_to | customer_addresses : customer_id , address_id , date_from , date_to | customer_orders : order_id , customer_id , order_status_code , order_date | department_stores : dept_store_id , dept_store_chain_id , store_name , store_address , store_phone , store_email | departments : department_id , dept_store_id , department_name | order_items : order_item_id , order_id , product_id | product_suppliers : product_id , supplier_id , date_supplied_from , date_supplied_to , total_amount_purchased , total_value_purchased | staff_department_assignments : staff_id , department_id , date_assigned_from , job_title_code , date_assigned_to | supplier_addresses.supplier_id = suppliers.supplier_id | supplier_addresses.address_id = addresses.address_id | customer_addresses.customer_id = customers.customer_id | customer_addresses.address_id = addresses.address_id | customer_orders.customer_id = customers.customer_id | department_stores.dept_store_chain_id = department_store_chain.dept_store_chain_id | departments.dept_store_id = department_stores.dept_store_id | order_items.product_id = products.product_id | order_items.order_id = customer_orders.order_id | product_suppliers.product_id = products.product_id | product_suppliers.supplier_id = suppliers.supplier_id | staff_department_assignments.staff_id = staff.staff_id | staff_department_assignments.department_id = departments.department_id | 

### Response:

select department_id from staff_department_assignments group by department_id order by count ( * ) asc limit 1