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

Convert text to sql: Show the names of customers who have both an order in completed status and an order in part status. | addresses : address_id , line_1_number_building , city , zip_postcode , state_province_county , country | products : product_id , product_type_code , product_name , product_price | customers : customer_id , payment_method_code , customer_number , customer_name , customer_address , customer_phone , customer_email | contacts : contact_id , customer_id , gender , first_name , last_name , contact_phone | customer_address_history : customer_id , address_id , date_from , date_to | customer_orders : order_id , customer_id , order_date , order_status_code | order_items : order_item_id , order_id , product_id , order_quantity | customer_address_history.address_id = addresses.address_id | customer_address_history.customer_id = customers.customer_id | customer_orders.customer_id = customers.customer_id | order_items.order_id = customer_orders.order_id | order_items.product_id = products.product_id | 

### Response:

select customers.customer_name from customers join customer_orders on customers.customer_id = customer_orders.customer_id where customer_orders.order_status_code = 'Completed' intersect select customers.customer_name from customers join customer_orders on customers.customer_id = customer_orders.customer_id where customer_orders.order_status_code = 'Part'

### Instruction:

Convert text to sql: Show the name, phone, and payment method code for all customers in descending order of customer number. | addresses : address_id , line_1_number_building , city , zip_postcode , state_province_county , country | products : product_id , product_type_code , product_name , product_price | customers : customer_id , payment_method_code , customer_number , customer_name , customer_address , customer_phone , customer_email | contacts : contact_id , customer_id , gender , first_name , last_name , contact_phone | customer_address_history : customer_id , address_id , date_from , date_to | customer_orders : order_id , customer_id , order_date , order_status_code | order_items : order_item_id , order_id , product_id , order_quantity | customer_address_history.address_id = addresses.address_id | customer_address_history.customer_id = customers.customer_id | customer_orders.customer_id = customers.customer_id | order_items.order_id = customer_orders.order_id | order_items.product_id = products.product_id | 

### Response:

select customer_name , customer_phone , payment_method_code from customers order by customer_number desc
### Instruction:

Convert text to sql: Show the product name and total order quantity for each product. | addresses : address_id , line_1_number_building , city , zip_postcode , state_province_county , country | products : product_id , product_type_code , product_name , product_price | customers : customer_id , payment_method_code , customer_number , customer_name , customer_address , customer_phone , customer_email | contacts : contact_id , customer_id , gender , first_name , last_name , contact_phone | customer_address_history : customer_id , address_id , date_from , date_to | customer_orders : order_id , customer_id , order_date , order_status_code | order_items : order_item_id , order_id , product_id , order_quantity | customer_address_history.address_id = addresses.address_id | customer_address_history.customer_id = customers.customer_id | customer_orders.customer_id = customers.customer_id | order_items.order_id = customer_orders.order_id | order_items.product_id = products.product_id | 

### Response:

select products.product_name , sum ( order_items.order_quantity ) from products join order_items on products.product_id = order_items.product_id group by products.product_id

### Instruction:

Convert text to sql: Show the minimum, maximum, average price for all products. | addresses : address_id , line_1_number_building , city , zip_postcode , state_province_county , country | products : product_id , product_type_code , product_name , product_price | customers : customer_id , payment_method_code , customer_number , customer_name , customer_address , customer_phone , customer_email | contacts : contact_id , customer_id , gender , first_name , last_name , contact_phone | customer_address_history : customer_id , address_id , date_from , date_to | customer_orders : order_id , customer_id , order_date , order_status_code | order_items : order_item_id , order_id , product_id , order_quantity | customer_address_history.address_id = addresses.address_id | customer_address_history.customer_id = customers.customer_id | customer_orders.customer_id = customers.customer_id | order_items.order_id = customer_orders.order_id | order_items.product_id = products.product_id | 

### Response:

select min ( product_price ) , max ( product_price ) , avg ( product_price ) from products
### Instruction:

Convert text to sql: How many products have a price higher than the average? | addresses : address_id , line_1_number_building , city , zip_postcode , state_province_county , country | products : product_id , product_type_code , product_name , product_price | customers : customer_id , payment_method_code , customer_number , customer_name , customer_address , customer_phone , customer_email | contacts : contact_id , customer_id , gender , first_name , last_name , contact_phone | customer_address_history : customer_id , address_id , date_from , date_to | customer_orders : order_id , customer_id , order_date , order_status_code | order_items : order_item_id , order_id , product_id , order_quantity | customer_address_history.address_id = addresses.address_id | customer_address_history.customer_id = customers.customer_id | customer_orders.customer_id = customers.customer_id | order_items.order_id = customer_orders.order_id | order_items.product_id = products.product_id | 

### Response:

select count ( * ) from products where product_price > ( select avg ( product_price ) from products )

### Instruction:

Convert text to sql: Show the customer name, customer address city, date from, and date to for each customer address history. | addresses : address_id , line_1_number_building , city , zip_postcode , state_province_county , country | products : product_id , product_type_code , product_name , product_price | customers : customer_id , payment_method_code , customer_number , customer_name , customer_address , customer_phone , customer_email | contacts : contact_id , customer_id , gender , first_name , last_name , contact_phone | customer_address_history : customer_id , address_id , date_from , date_to | customer_orders : order_id , customer_id , order_date , order_status_code | order_items : order_item_id , order_id , product_id , order_quantity | customer_address_history.address_id = addresses.address_id | customer_address_history.customer_id = customers.customer_id | customer_orders.customer_id = customers.customer_id | order_items.order_id = customer_orders.order_id | order_items.product_id = products.product_id | 

### Response:

select customers.customer_name , addresses.city , customer_address_history.date_from , customer_address_history.date_to from customer_address_history join customers on customer_address_history.customer_id = customers.customer_id join addresses on customer_address_history.address_id = addresses.address_id
### Instruction:

Convert text to sql: Show the names of customers who use Credit Card payment method and have more than 2 orders. | addresses : address_id , line_1_number_building , city , zip_postcode , state_province_county , country | products : product_id , product_type_code , product_name , product_price | customers : customer_id , payment_method_code , customer_number , customer_name , customer_address , customer_phone , customer_email | contacts : contact_id , customer_id , gender , first_name , last_name , contact_phone | customer_address_history : customer_id , address_id , date_from , date_to | customer_orders : order_id , customer_id , order_date , order_status_code | order_items : order_item_id , order_id , product_id , order_quantity | customer_address_history.address_id = addresses.address_id | customer_address_history.customer_id = customers.customer_id | customer_orders.customer_id = customers.customer_id | order_items.order_id = customer_orders.order_id | order_items.product_id = products.product_id | 

### Response:

select customers.customer_name from customers join customer_orders on customers.customer_id = customer_orders.customer_id where customers.payment_method_code = 'Credit Card' group by customers.customer_id having count ( * ) > 2

### Instruction:

Convert text to sql: What are the name and phone of the customer with the most ordered product quantity? | addresses : address_id , line_1_number_building , city , zip_postcode , state_province_county , country | products : product_id , product_type_code , product_name , product_price | customers : customer_id , payment_method_code , customer_number , customer_name , customer_address , customer_phone , customer_email | contacts : contact_id , customer_id , gender , first_name , last_name , contact_phone | customer_address_history : customer_id , address_id , date_from , date_to | customer_orders : order_id , customer_id , order_date , order_status_code | order_items : order_item_id , order_id , product_id , order_quantity | customer_address_history.address_id = addresses.address_id | customer_address_history.customer_id = customers.customer_id | customer_orders.customer_id = customers.customer_id | order_items.order_id = customer_orders.order_id | order_items.product_id = products.product_id | 

### Response:

select customers.customer_name , customers.customer_phone from customers join customer_orders on customers.customer_id = customer_orders.customer_id join order_items on order_items.order_id = customer_orders.order_id group by customers.customer_id order by sum ( order_items.order_quantity ) desc limit 1
### Instruction:

Convert text to sql: Show the product type and name for the products with price higher than 1000 or lower than 500. | addresses : address_id , line_1_number_building , city , zip_postcode , state_province_county , country | products : product_id , product_type_code , product_name , product_price | customers : customer_id , payment_method_code , customer_number , customer_name , customer_address , customer_phone , customer_email | contacts : contact_id , customer_id , gender , first_name , last_name , contact_phone | customer_address_history : customer_id , address_id , date_from , date_to | customer_orders : order_id , customer_id , order_date , order_status_code | order_items : order_item_id , order_id , product_id , order_quantity | customer_address_history.address_id = addresses.address_id | customer_address_history.customer_id = customers.customer_id | customer_orders.customer_id = customers.customer_id | order_items.order_id = customer_orders.order_id | order_items.product_id = products.product_id | 

### Response:

select product_type_code , product_name from products where product_price > 1000 or product_price < 500
### Instruction:

Convert text to sql: Find the name of dorms only for female (F gender). | student : stuid , lname , fname , age , sex , major , advisor , city_code | dorm : dormid , dorm_name , student_capacity , gender | dorm_amenity : amenid , amenity_name | has_amenity : dormid , amenid | lives_in : stuid , dormid , room_number | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid | 

### Response:

select dorm_name from dorm where gender = 'F'

### Instruction:

Convert text to sql: What are the names of the all-female dorms? | student : stuid , lname , fname , age , sex , major , advisor , city_code | dorm : dormid , dorm_name , student_capacity , gender | dorm_amenity : amenid , amenity_name | has_amenity : dormid , amenid | lives_in : stuid , dormid , room_number | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid | 

### Response:

select dorm_name from dorm where gender = 'F'

### Instruction:

Convert text to sql: Find the name of dorms that can accommodate more than 300 students. | student : stuid , lname , fname , age , sex , major , advisor , city_code | dorm : dormid , dorm_name , student_capacity , gender | dorm_amenity : amenid , amenity_name | has_amenity : dormid , amenid | lives_in : stuid , dormid , room_number | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid | 

### Response:

select dorm_name from dorm where student_capacity > 300

### Instruction:

Convert text to sql: What are the names of all the dorms that can accomdate more than 300 students? | student : stuid , lname , fname , age , sex , major , advisor , city_code | dorm : dormid , dorm_name , student_capacity , gender | dorm_amenity : amenid , amenity_name | has_amenity : dormid , amenid | lives_in : stuid , dormid , room_number | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid | 

### Response:

select dorm_name from dorm where student_capacity > 300

### Instruction:

Convert text to sql: How many female students (sex is F) whose age is below 25? | student : stuid , lname , fname , age , sex , major , advisor , city_code | dorm : dormid , dorm_name , student_capacity , gender | dorm_amenity : amenid , amenity_name | has_amenity : dormid , amenid | lives_in : stuid , dormid , room_number | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid | 

### Response:

select count ( * ) from student where sex = 'F' and age < 25
### Instruction:

Convert text to sql: How many girl students who are younger than 25? | student : stuid , lname , fname , age , sex , major , advisor , city_code | dorm : dormid , dorm_name , student_capacity , gender | dorm_amenity : amenid , amenity_name | has_amenity : dormid , amenid | lives_in : stuid , dormid , room_number | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid | 

### Response:

select count ( * ) from student where sex = 'F' and age < 25

### Instruction:

Convert text to sql: Find the first name of students who is older than 20. | student : stuid , lname , fname , age , sex , major , advisor , city_code | dorm : dormid , dorm_name , student_capacity , gender | dorm_amenity : amenid , amenity_name | has_amenity : dormid , amenid | lives_in : stuid , dormid , room_number | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid | 

### Response:

select fname from student where age > 20

### Instruction:

Convert text to sql: What are the first names of all students who are older than 20? | student : stuid , lname , fname , age , sex , major , advisor , city_code | dorm : dormid , dorm_name , student_capacity , gender | dorm_amenity : amenid , amenity_name | has_amenity : dormid , amenid | lives_in : stuid , dormid , room_number | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid | 

### Response:

select fname from student where age > 20

### Instruction:

Convert text to sql: Find the first name of students living in city PHL whose age is between 20 and 25. | student : stuid , lname , fname , age , sex , major , advisor , city_code | dorm : dormid , dorm_name , student_capacity , gender | dorm_amenity : amenid , amenity_name | has_amenity : dormid , amenid | lives_in : stuid , dormid , room_number | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid | 

### Response:

select fname from student where city_code = 'PHL' and age between 20 and 25

### Instruction:

Convert text to sql: What is the first name of the students who are in age 20 to 25 and living in PHL city? | student : stuid , lname , fname , age , sex , major , advisor , city_code | dorm : dormid , dorm_name , student_capacity , gender | dorm_amenity : amenid , amenity_name | has_amenity : dormid , amenid | lives_in : stuid , dormid , room_number | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid | 

### Response:

select fname from student where city_code = 'PHL' and age between 20 and 25
### Instruction:

Convert text to sql: How many dorms are there? | student : stuid , lname , fname , age , sex , major , advisor , city_code | dorm : dormid , dorm_name , student_capacity , gender | dorm_amenity : amenid , amenity_name | has_amenity : dormid , amenid | lives_in : stuid , dormid , room_number | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid | 

### Response:

select count ( * ) from dorm

### Instruction:

Convert text to sql: How many dorms are in the database? | student : stuid , lname , fname , age , sex , major , advisor , city_code | dorm : dormid , dorm_name , student_capacity , gender | dorm_amenity : amenid , amenity_name | has_amenity : dormid , amenid | lives_in : stuid , dormid , room_number | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid | 

### Response:

select count ( * ) from dorm

### Instruction:

Convert text to sql: Find the number of distinct amenities. | student : stuid , lname , fname , age , sex , major , advisor , city_code | dorm : dormid , dorm_name , student_capacity , gender | dorm_amenity : amenid , amenity_name | has_amenity : dormid , amenid | lives_in : stuid , dormid , room_number | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid | 

### Response:

select count ( * ) from dorm_amenity

### Instruction:

Convert text to sql: How many diffrent dorm amenities are there? | student : stuid , lname , fname , age , sex , major , advisor , city_code | dorm : dormid , dorm_name , student_capacity , gender | dorm_amenity : amenid , amenity_name | has_amenity : dormid , amenid | lives_in : stuid , dormid , room_number | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid | 

### Response:

select count ( * ) from dorm_amenity

### Instruction:

Convert text to sql: Find the total capacity of all dorms. | student : stuid , lname , fname , age , sex , major , advisor , city_code | dorm : dormid , dorm_name , student_capacity , gender | dorm_amenity : amenid , amenity_name | has_amenity : dormid , amenid | lives_in : stuid , dormid , room_number | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid | 

### Response:

select sum ( student_capacity ) from dorm

### Instruction:

Convert text to sql: What is the total student capacity of all dorms? | student : stuid , lname , fname , age , sex , major , advisor , city_code | dorm : dormid , dorm_name , student_capacity , gender | dorm_amenity : amenid , amenity_name | has_amenity : dormid , amenid | lives_in : stuid , dormid , room_number | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid | 

### Response:

select sum ( student_capacity ) from dorm
### Instruction:

Convert text to sql: How many students are there? | student : stuid , lname , fname , age , sex , major , advisor , city_code | dorm : dormid , dorm_name , student_capacity , gender | dorm_amenity : amenid , amenity_name | has_amenity : dormid , amenid | lives_in : stuid , dormid , room_number | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid | 

### Response:

select count ( * ) from student

### Instruction:

Convert text to sql: How many students exist? | student : stuid , lname , fname , age , sex , major , advisor , city_code | dorm : dormid , dorm_name , student_capacity , gender | dorm_amenity : amenid , amenity_name | has_amenity : dormid , amenid | lives_in : stuid , dormid , room_number | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid | 

### Response:

select count ( * ) from student

### Instruction:

Convert text to sql: Find the average age of all students living in the each city. | student : stuid , lname , fname , age , sex , major , advisor , city_code | dorm : dormid , dorm_name , student_capacity , gender | dorm_amenity : amenid , amenity_name | has_amenity : dormid , amenid | lives_in : stuid , dormid , room_number | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid | 

### Response:

select avg ( age ) , city_code from student group by city_code

### Instruction:

Convert text to sql: What is the average age for each city and what are those cities? | student : stuid , lname , fname , age , sex , major , advisor , city_code | dorm : dormid , dorm_name , student_capacity , gender | dorm_amenity : amenid , amenity_name | has_amenity : dormid , amenid | lives_in : stuid , dormid , room_number | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid | 

### Response:

select avg ( age ) , city_code from student group by city_code

### Instruction:

Convert text to sql: Find the average and total capacity of dorms for the students with gender X. | student : stuid , lname , fname , age , sex , major , advisor , city_code | dorm : dormid , dorm_name , student_capacity , gender | dorm_amenity : amenid , amenity_name | has_amenity : dormid , amenid | lives_in : stuid , dormid , room_number | has_amenity.amenid = dorm_amenity.amenid | has_amenity.dormid = dorm.dormid | lives_in.dormid = dorm.dormid | lives_in.stuid = student.stuid | 

### Response:

select avg ( student_capacity ) , sum ( student_capacity ) from dorm where gender = 'X'