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

Convert text to sql: How many heads of the departments are older than 56 ? | department : department_id , name , creation , ranking , budget_in_billions , num_employees | head : head_id , name , born_state , age | management : department_id , head_id , temporary_acting | management.head_id = head.head_id | management.department_id = department.department_id | 

### Response:

select count ( * ) from head where age > 56

### Instruction:

Convert text to sql: List the name, born state and age of the heads of departments ordered by age. | department : department_id , name , creation , ranking , budget_in_billions , num_employees | head : head_id , name , born_state , age | management : department_id , head_id , temporary_acting | management.head_id = head.head_id | management.department_id = department.department_id | 

### Response:

select name , born_state , age from head order by age asc

### Instruction:

Convert text to sql: List the creation year, name and budget of each department. | department : department_id , name , creation , ranking , budget_in_billions , num_employees | head : head_id , name , born_state , age | management : department_id , head_id , temporary_acting | management.head_id = head.head_id | management.department_id = department.department_id | 

### Response:

select creation , name , budget_in_billions from department

### Instruction:

Convert text to sql: What are the maximum and minimum budget of the departments? | department : department_id , name , creation , ranking , budget_in_billions , num_employees | head : head_id , name , born_state , age | management : department_id , head_id , temporary_acting | management.head_id = head.head_id | management.department_id = department.department_id | 

### Response:

select max ( budget_in_billions ) , min ( budget_in_billions ) from department

### Instruction:

Convert text to sql: What is the average number of employees of the departments whose rank is between 10 and 15? | department : department_id , name , creation , ranking , budget_in_billions , num_employees | head : head_id , name , born_state , age | management : department_id , head_id , temporary_acting | management.head_id = head.head_id | management.department_id = department.department_id | 

### Response:

select avg ( num_employees ) from department where ranking between 10 and 15

### Instruction:

Convert text to sql: What are the names of the heads who are born outside the California state? | department : department_id , name , creation , ranking , budget_in_billions , num_employees | head : head_id , name , born_state , age | management : department_id , head_id , temporary_acting | management.head_id = head.head_id | management.department_id = department.department_id | 

### Response:

select name from head where born_state != 'California'
### Instruction:

Convert text to sql: What are the distinct creation years of the departments managed by a secretary born in state 'Alabama'? | department : department_id , name , creation , ranking , budget_in_billions , num_employees | head : head_id , name , born_state , age | management : department_id , head_id , temporary_acting | management.head_id = head.head_id | management.department_id = department.department_id | 

### Response:

select distinct department.creation from department join management on department.department_id = management.department_id join head on management.head_id = head.head_id where head.born_state = 'Alabama'

### Instruction:

Convert text to sql: What are the names of the states where at least 3 heads were born? | department : department_id , name , creation , ranking , budget_in_billions , num_employees | head : head_id , name , born_state , age | management : department_id , head_id , temporary_acting | management.head_id = head.head_id | management.department_id = department.department_id | 

### Response:

select born_state from head group by born_state having count ( * ) >= 3

### Instruction:

Convert text to sql: In which year were most departments established? | department : department_id , name , creation , ranking , budget_in_billions , num_employees | head : head_id , name , born_state , age | management : department_id , head_id , temporary_acting | management.head_id = head.head_id | management.department_id = department.department_id | 

### Response:

select creation from department group by creation order by count ( * ) desc limit 1

### Instruction:

Convert text to sql: Show the name and number of employees for the departments managed by heads whose temporary acting value is 'Yes'? | department : department_id , name , creation , ranking , budget_in_billions , num_employees | head : head_id , name , born_state , age | management : department_id , head_id , temporary_acting | management.head_id = head.head_id | management.department_id = department.department_id | 

### Response:

select department.name , department.num_employees from department join management on department.department_id = management.department_id where management.temporary_acting = 'Yes'

### Instruction:

Convert text to sql: How many acting statuses are there? | department : department_id , name , creation , ranking , budget_in_billions , num_employees | head : head_id , name , born_state , age | management : department_id , head_id , temporary_acting | management.head_id = head.head_id | management.department_id = department.department_id | 

### Response:

select count ( distinct temporary_acting ) from management

### Instruction:

Convert text to sql: How many departments are led by heads who are not mentioned? | department : department_id , name , creation , ranking , budget_in_billions , num_employees | head : head_id , name , born_state , age | management : department_id , head_id , temporary_acting | management.head_id = head.head_id | management.department_id = department.department_id | 

### Response:

select count ( * ) from department where department_id not in ( select department_id from management )
### Instruction:

Convert text to sql: What are the distinct ages of the heads who are acting? | department : department_id , name , creation , ranking , budget_in_billions , num_employees | head : head_id , name , born_state , age | management : department_id , head_id , temporary_acting | management.head_id = head.head_id | management.department_id = department.department_id | 

### Response:

select distinct head.age from management join head on head.head_id = management.head_id where management.temporary_acting = 'Yes'

### Instruction:

Convert text to sql: List the states where both the secretary of 'Treasury' department and the secretary of 'Homeland Security' were born. | department : department_id , name , creation , ranking , budget_in_billions , num_employees | head : head_id , name , born_state , age | management : department_id , head_id , temporary_acting | management.head_id = head.head_id | management.department_id = department.department_id | 

### Response:

select head.born_state from department join management on department.department_id = management.department_id join head on management.head_id = head.head_id where department.name = 'Treasury' intersect select head.born_state from department join management on department.department_id = management.department_id join head on management.head_id = head.head_id where department.name = 'Homeland Security'

### Instruction:

Convert text to sql: Which department has more than 1 head at a time? List the id, name and the number of heads. | department : department_id , name , creation , ranking , budget_in_billions , num_employees | head : head_id , name , born_state , age | management : department_id , head_id , temporary_acting | management.head_id = head.head_id | management.department_id = department.department_id | 

### Response:

select department.department_id , department.name , count ( * ) from management join department on department.department_id = management.department_id group by department.department_id having count ( * ) > 1

### Instruction:

Convert text to sql: Which head's name has the substring 'Ha'? List the id and name. | department : department_id , name , creation , ranking , budget_in_billions , num_employees | head : head_id , name , born_state , age | management : department_id , head_id , temporary_acting | management.head_id = head.head_id | management.department_id = department.department_id | 

### Response:

select head_id , name from head where name like '%Ha%'
### Instruction:

Convert text to sql: How many farms are there? | city : city_id , official_name , status , area_km_2 , population , census_ranking | farm : farm_id , year , total_horses , working_horses , total_cattle , oxen , bulls , cows , pigs , sheep_and_goats | farm_competition : competition_id , year , theme , host_city_id , hosts | competition_record : competition_id , farm_id , rank | farm_competition.host_city_id = city.city_id | competition_record.farm_id = farm.farm_id | competition_record.competition_id = farm_competition.competition_id | 

### Response:

select count ( * ) from farm

### Instruction:

Convert text to sql: Count the number of farms. | city : city_id , official_name , status , area_km_2 , population , census_ranking | farm : farm_id , year , total_horses , working_horses , total_cattle , oxen , bulls , cows , pigs , sheep_and_goats | farm_competition : competition_id , year , theme , host_city_id , hosts | competition_record : competition_id , farm_id , rank | farm_competition.host_city_id = city.city_id | competition_record.farm_id = farm.farm_id | competition_record.competition_id = farm_competition.competition_id | 

### Response:

select count ( * ) from farm

### Instruction:

Convert text to sql: List the total number of horses on farms in ascending order. | city : city_id , official_name , status , area_km_2 , population , census_ranking | farm : farm_id , year , total_horses , working_horses , total_cattle , oxen , bulls , cows , pigs , sheep_and_goats | farm_competition : competition_id , year , theme , host_city_id , hosts | competition_record : competition_id , farm_id , rank | farm_competition.host_city_id = city.city_id | competition_record.farm_id = farm.farm_id | competition_record.competition_id = farm_competition.competition_id | 

### Response:

select total_horses from farm order by total_horses asc

### Instruction:

Convert text to sql: What is the total horses record for each farm, sorted ascending? | city : city_id , official_name , status , area_km_2 , population , census_ranking | farm : farm_id , year , total_horses , working_horses , total_cattle , oxen , bulls , cows , pigs , sheep_and_goats | farm_competition : competition_id , year , theme , host_city_id , hosts | competition_record : competition_id , farm_id , rank | farm_competition.host_city_id = city.city_id | competition_record.farm_id = farm.farm_id | competition_record.competition_id = farm_competition.competition_id | 

### Response:

select total_horses from farm order by total_horses asc
### Instruction:

Convert text to sql: What are the hosts of competitions whose theme is not "Aliens"? | city : city_id , official_name , status , area_km_2 , population , census_ranking | farm : farm_id , year , total_horses , working_horses , total_cattle , oxen , bulls , cows , pigs , sheep_and_goats | farm_competition : competition_id , year , theme , host_city_id , hosts | competition_record : competition_id , farm_id , rank | farm_competition.host_city_id = city.city_id | competition_record.farm_id = farm.farm_id | competition_record.competition_id = farm_competition.competition_id | 

### Response:

select hosts from farm_competition where theme != 'Aliens'

### Instruction:

Convert text to sql: Return the hosts of competitions for which the theme is not Aliens? | city : city_id , official_name , status , area_km_2 , population , census_ranking | farm : farm_id , year , total_horses , working_horses , total_cattle , oxen , bulls , cows , pigs , sheep_and_goats | farm_competition : competition_id , year , theme , host_city_id , hosts | competition_record : competition_id , farm_id , rank | farm_competition.host_city_id = city.city_id | competition_record.farm_id = farm.farm_id | competition_record.competition_id = farm_competition.competition_id | 

### Response:

select hosts from farm_competition where theme != 'Aliens'

### Instruction:

Convert text to sql: What are the themes of farm competitions sorted by year in ascending order? | city : city_id , official_name , status , area_km_2 , population , census_ranking | farm : farm_id , year , total_horses , working_horses , total_cattle , oxen , bulls , cows , pigs , sheep_and_goats | farm_competition : competition_id , year , theme , host_city_id , hosts | competition_record : competition_id , farm_id , rank | farm_competition.host_city_id = city.city_id | competition_record.farm_id = farm.farm_id | competition_record.competition_id = farm_competition.competition_id | 

### Response:

select theme from farm_competition order by year asc

### Instruction:

Convert text to sql: Return the themes of farm competitions, sorted by year ascending. | city : city_id , official_name , status , area_km_2 , population , census_ranking | farm : farm_id , year , total_horses , working_horses , total_cattle , oxen , bulls , cows , pigs , sheep_and_goats | farm_competition : competition_id , year , theme , host_city_id , hosts | competition_record : competition_id , farm_id , rank | farm_competition.host_city_id = city.city_id | competition_record.farm_id = farm.farm_id | competition_record.competition_id = farm_competition.competition_id | 

### Response:

select theme from farm_competition order by year asc
### Instruction:

Convert text to sql: What is the average number of working horses of farms with more than 5000 total number of horses? | city : city_id , official_name , status , area_km_2 , population , census_ranking | farm : farm_id , year , total_horses , working_horses , total_cattle , oxen , bulls , cows , pigs , sheep_and_goats | farm_competition : competition_id , year , theme , host_city_id , hosts | competition_record : competition_id , farm_id , rank | farm_competition.host_city_id = city.city_id | competition_record.farm_id = farm.farm_id | competition_record.competition_id = farm_competition.competition_id | 

### Response:

select avg ( working_horses ) from farm where total_horses > 5000

### Instruction:

Convert text to sql: Give the average number of working horses on farms with more than 5000 total horses. | city : city_id , official_name , status , area_km_2 , population , census_ranking | farm : farm_id , year , total_horses , working_horses , total_cattle , oxen , bulls , cows , pigs , sheep_and_goats | farm_competition : competition_id , year , theme , host_city_id , hosts | competition_record : competition_id , farm_id , rank | farm_competition.host_city_id = city.city_id | competition_record.farm_id = farm.farm_id | competition_record.competition_id = farm_competition.competition_id | 

### Response:

select avg ( working_horses ) from farm where total_horses > 5000

### Instruction:

Convert text to sql: What are the maximum and minimum number of cows across all farms. | city : city_id , official_name , status , area_km_2 , population , census_ranking | farm : farm_id , year , total_horses , working_horses , total_cattle , oxen , bulls , cows , pigs , sheep_and_goats | farm_competition : competition_id , year , theme , host_city_id , hosts | competition_record : competition_id , farm_id , rank | farm_competition.host_city_id = city.city_id | competition_record.farm_id = farm.farm_id | competition_record.competition_id = farm_competition.competition_id | 

### Response:

select max ( cows ) , min ( cows ) from farm

### Instruction:

Convert text to sql: Return the maximum and minimum number of cows across all farms. | city : city_id , official_name , status , area_km_2 , population , census_ranking | farm : farm_id , year , total_horses , working_horses , total_cattle , oxen , bulls , cows , pigs , sheep_and_goats | farm_competition : competition_id , year , theme , host_city_id , hosts | competition_record : competition_id , farm_id , rank | farm_competition.host_city_id = city.city_id | competition_record.farm_id = farm.farm_id | competition_record.competition_id = farm_competition.competition_id | 

### Response:

select max ( cows ) , min ( cows ) from farm
### Instruction:

Convert text to sql: How many different statuses do cities have? | city : city_id , official_name , status , area_km_2 , population , census_ranking | farm : farm_id , year , total_horses , working_horses , total_cattle , oxen , bulls , cows , pigs , sheep_and_goats | farm_competition : competition_id , year , theme , host_city_id , hosts | competition_record : competition_id , farm_id , rank | farm_competition.host_city_id = city.city_id | competition_record.farm_id = farm.farm_id | competition_record.competition_id = farm_competition.competition_id | 

### Response:

select count ( distinct status ) from city

### Instruction:

Convert text to sql: Count the number of different statuses. | city : city_id , official_name , status , area_km_2 , population , census_ranking | farm : farm_id , year , total_horses , working_horses , total_cattle , oxen , bulls , cows , pigs , sheep_and_goats | farm_competition : competition_id , year , theme , host_city_id , hosts | competition_record : competition_id , farm_id , rank | farm_competition.host_city_id = city.city_id | competition_record.farm_id = farm.farm_id | competition_record.competition_id = farm_competition.competition_id | 

### Response:

select count ( distinct status ) from city

### Instruction:

Convert text to sql: List official names of cities in descending order of population. | city : city_id , official_name , status , area_km_2 , population , census_ranking | farm : farm_id , year , total_horses , working_horses , total_cattle , oxen , bulls , cows , pigs , sheep_and_goats | farm_competition : competition_id , year , theme , host_city_id , hosts | competition_record : competition_id , farm_id , rank | farm_competition.host_city_id = city.city_id | competition_record.farm_id = farm.farm_id | competition_record.competition_id = farm_competition.competition_id | 

### Response:

select official_name from city order by population desc

### Instruction:

Convert text to sql: What are the official names of cities, ordered descending by population? | city : city_id , official_name , status , area_km_2 , population , census_ranking | farm : farm_id , year , total_horses , working_horses , total_cattle , oxen , bulls , cows , pigs , sheep_and_goats | farm_competition : competition_id , year , theme , host_city_id , hosts | competition_record : competition_id , farm_id , rank | farm_competition.host_city_id = city.city_id | competition_record.farm_id = farm.farm_id | competition_record.competition_id = farm_competition.competition_id | 

### Response:

select official_name from city order by population desc
### Instruction:

Convert text to sql: List the official name and status of the city with the largest population. | city : city_id , official_name , status , area_km_2 , population , census_ranking | farm : farm_id , year , total_horses , working_horses , total_cattle , oxen , bulls , cows , pigs , sheep_and_goats | farm_competition : competition_id , year , theme , host_city_id , hosts | competition_record : competition_id , farm_id , rank | farm_competition.host_city_id = city.city_id | competition_record.farm_id = farm.farm_id | competition_record.competition_id = farm_competition.competition_id | 

### Response:

select official_name , status from city order by population desc limit 1

### Instruction:

Convert text to sql: What is the official name and status of the city with the most residents? | city : city_id , official_name , status , area_km_2 , population , census_ranking | farm : farm_id , year , total_horses , working_horses , total_cattle , oxen , bulls , cows , pigs , sheep_and_goats | farm_competition : competition_id , year , theme , host_city_id , hosts | competition_record : competition_id , farm_id , rank | farm_competition.host_city_id = city.city_id | competition_record.farm_id = farm.farm_id | competition_record.competition_id = farm_competition.competition_id | 

### Response:

select official_name , status from city order by population desc limit 1

### Instruction:

Convert text to sql: Show the years and the official names of the host cities of competitions. | city : city_id , official_name , status , area_km_2 , population , census_ranking | farm : farm_id , year , total_horses , working_horses , total_cattle , oxen , bulls , cows , pigs , sheep_and_goats | farm_competition : competition_id , year , theme , host_city_id , hosts | competition_record : competition_id , farm_id , rank | farm_competition.host_city_id = city.city_id | competition_record.farm_id = farm.farm_id | competition_record.competition_id = farm_competition.competition_id | 

### Response:

select farm_competition.year , city.official_name from city join farm_competition on city.city_id = farm_competition.host_city_id

### Instruction:

Convert text to sql: Give the years and official names of the cities of each competition. | city : city_id , official_name , status , area_km_2 , population , census_ranking | farm : farm_id , year , total_horses , working_horses , total_cattle , oxen , bulls , cows , pigs , sheep_and_goats | farm_competition : competition_id , year , theme , host_city_id , hosts | competition_record : competition_id , farm_id , rank | farm_competition.host_city_id = city.city_id | competition_record.farm_id = farm.farm_id | competition_record.competition_id = farm_competition.competition_id | 

### Response:

select farm_competition.year , city.official_name from city join farm_competition on city.city_id = farm_competition.host_city_id