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

Convert text to sql: How many students are there in each major? | 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 ( * ) , major from student group by major

### Instruction:

Convert text to sql: Find the number and average age of students living in 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 count ( * ) , avg ( age ) , city_code from student group by city_code

### Instruction:

Convert text to sql: How many students live in each city and what are their average ages? | 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 ( * ) , avg ( age ) , city_code from student group by city_code

### Instruction:

Convert text to sql: Find the average age and number of male students (with sex M) from 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 count ( * ) , avg ( age ) , city_code from student where sex = 'M' group by city_code

### Instruction:

Convert text to sql: What is the average age and how many male students are there in 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 count ( * ) , avg ( age ) , city_code from student where sex = 'M' group by city_code
### Instruction:

Convert text to sql: Find the number of students for the cities where have more than one student. | 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 ( * ) , city_code from student group by city_code having count ( * ) > 1

### Instruction:

Convert text to sql: How many students are from each city, and which cities have more than one 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 count ( * ) , city_code from student group by city_code having count ( * ) > 1

### Instruction:

Convert text to sql: Find the first and last name of students who are not in the largest major. | 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 , lname from student where major != ( select major from student group by major order by count ( * ) desc limit 1 )

### Instruction:

Convert text to sql: What is the first and last name of the students who are not in the largest major? | 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 , lname from student where major != ( select major from student group by major order by count ( * ) desc limit 1 )

### Instruction:

Convert text to sql: Find the number of students whose age is older than the average age for each 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 count ( * ) , sex from student where age > ( select avg ( age ) from student ) group by sex
### Instruction:

Convert text to sql: How many students are older than average for each 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 count ( * ) , sex from student where age > ( select avg ( age ) from student ) group by sex

### Instruction:

Convert text to sql: Find the average age of students living in each dorm and the name of dorm. | 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.age ) , dorm.dorm_name from student join lives_in on student.stuid = lives_in.stuid join dorm on dorm.dormid = lives_in.dormid group by dorm.dorm_name

### Instruction:

Convert text to sql: What is the average age for each dorm and what are the names of each dorm? | 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.age ) , dorm.dorm_name from student join lives_in on student.stuid = lives_in.stuid join dorm on dorm.dormid = lives_in.dormid group by dorm.dorm_name

### Instruction:

Convert text to sql: Find the number of amenities for each of the dorms that can accommodate more than 100 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 count ( * ) , dorm.dormid from dorm join has_amenity on dorm.dormid = has_amenity.dormid where dorm.student_capacity > 100 group by dorm.dormid
### Instruction:

Convert text to sql: For each dorm, how many amenities does it have? | 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 ( * ) , dorm.dormid from dorm join has_amenity on dorm.dormid = has_amenity.dormid where dorm.student_capacity > 100 group by dorm.dormid

### Instruction:

Convert text to sql: Find the number of students who is older than 20 in each dorm. | 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 ( * ) , dorm.dorm_name from student join lives_in on student.stuid = lives_in.stuid join dorm on dorm.dormid = lives_in.dormid where student.age > 20 group by dorm.dorm_name

### Instruction:

Convert text to sql: How many students are older than 20 in each dorm? | 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 ( * ) , dorm.dorm_name from student join lives_in on student.stuid = lives_in.stuid join dorm on dorm.dormid = lives_in.dormid where student.age > 20 group by dorm.dorm_name

### Instruction:

Convert text to sql: Find the first name of students who are living in the Smith Hall. | 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 student.fname from student join lives_in on student.stuid = lives_in.stuid join dorm on dorm.dormid = lives_in.dormid where dorm.dorm_name = 'Smith Hall'
### Instruction:

Convert text to sql: What are the first names of all students in Smith Hall? | 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 student.fname from student join lives_in on student.stuid = lives_in.stuid join dorm on dorm.dormid = lives_in.dormid where dorm.dorm_name = 'Smith Hall'

### Instruction:

Convert text to sql: Find the average age of students who are living in the dorm with the largest capacity. | 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.age ) from student join lives_in on student.stuid = lives_in.stuid join dorm on dorm.dormid = lives_in.dormid where dorm.student_capacity = ( select max ( student_capacity ) from dorm )

### Instruction:

Convert text to sql: What is the average age of students who are living in the dorm with the largest capacity? | 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.age ) from student join lives_in on student.stuid = lives_in.stuid join dorm on dorm.dormid = lives_in.dormid where dorm.student_capacity = ( select max ( student_capacity ) from dorm )

### Instruction:

Convert text to sql: Find the total number of students living in the male dorm (with gender M). | 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 join lives_in on student.stuid = lives_in.stuid join dorm on dorm.dormid = lives_in.dormid where dorm.gender = 'M'
### Instruction:

Convert text to sql: What are the total number of students who are living in a male dorm? | 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 join lives_in on student.stuid = lives_in.stuid join dorm on dorm.dormid = lives_in.dormid where dorm.gender = 'M'

### Instruction:

Convert text to sql: Find the number of female students (with F sex) living in Smith Hall | 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 join lives_in on student.stuid = lives_in.stuid join dorm on dorm.dormid = lives_in.dormid where dorm.dorm_name = 'Smith Hall' and student.sex = 'F'

### Instruction:

Convert text to sql: How many female students live in Smith Hall? | 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 join lives_in on student.stuid = lives_in.stuid join dorm on dorm.dormid = lives_in.dormid where dorm.dorm_name = 'Smith Hall' and student.sex = 'F'

### Instruction:

Convert text to sql: Find the name of amenities Smith Hall dorm have. | 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_amenity.amenity_name from dorm join has_amenity on dorm.dormid = has_amenity.dormid join dorm_amenity on has_amenity.amenid = dorm_amenity.amenid where dorm.dorm_name = 'Smith Hall'
### Instruction:

Convert text to sql: What are the names of the amenities that Smith Hall has? | 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_amenity.amenity_name from dorm join has_amenity on dorm.dormid = has_amenity.dormid join dorm_amenity on has_amenity.amenid = dorm_amenity.amenid where dorm.dorm_name = 'Smith Hall'

### Instruction:

Convert text to sql: Find the name of amenities Smith Hall dorm have. ordered the results by amenity names. | 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_amenity.amenity_name from dorm join has_amenity on dorm.dormid = has_amenity.dormid join dorm_amenity on has_amenity.amenid = dorm_amenity.amenid where dorm.dorm_name = 'Smith Hall' order by dorm_amenity.amenity_name asc

### Instruction:

Convert text to sql: What amenities does Smith Hall have in alphabetical order? | 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_amenity.amenity_name from dorm join has_amenity on dorm.dormid = has_amenity.dormid join dorm_amenity on has_amenity.amenid = dorm_amenity.amenid where dorm.dorm_name = 'Smith Hall' order by dorm_amenity.amenity_name asc

### Instruction:

Convert text to sql: Find the name of amenity that is most common in 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 dorm_amenity.amenity_name from dorm_amenity join has_amenity on dorm_amenity.amenid = has_amenity.amenid group by has_amenity.amenid order by count ( * ) desc limit 1
### Instruction:

Convert text to sql: What is the most common amenity in the 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_amenity.amenity_name from dorm_amenity join has_amenity on dorm_amenity.amenid = has_amenity.amenid group by has_amenity.amenid order by count ( * ) desc limit 1

### Instruction:

Convert text to sql: Find the first name of students who are living in the dorm that has most number of 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 student.fname from student join lives_in on student.stuid = lives_in.stuid where lives_in.dormid in ( select lives_in.dormid from dorm join has_amenity on dorm.dormid = has_amenity.dormid join dorm_amenity on has_amenity.amenid = dorm_amenity.amenid group by dorm.dormid order by count ( * ) desc limit 1 )

### Instruction:

Convert text to sql: What are the first names of all students who live in the dorm with the most 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 student.fname from student join lives_in on student.stuid = lives_in.stuid where lives_in.dormid in ( select lives_in.dormid from dorm join has_amenity on dorm.dormid = has_amenity.dormid join dorm_amenity on has_amenity.amenid = dorm_amenity.amenid group by dorm.dormid order by count ( * ) desc limit 1 )

### Instruction:

Convert text to sql: Find the name and capacity of the dorm with least number of 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 dorm.dorm_name , dorm.student_capacity from dorm join has_amenity on dorm.dormid = has_amenity.dormid join dorm_amenity on has_amenity.amenid = dorm_amenity.amenid group by has_amenity.dormid order by count ( * ) asc limit 1