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

Convert text to sql: What is the name of the person whose age is below 30? | person : name , age , city , gender , job | personfriend : name , friend , year | personfriend.friend = person.name | personfriend.name = person.name | 

### Response:

select name from person where age < 30

### Instruction:

Convert text to sql: How many people whose age is greater 30 and job is engineer? | person : name , age , city , gender , job | personfriend : name , friend , year | personfriend.friend = person.name | personfriend.name = person.name | 

### Response:

select count ( * ) from person where age > 30 and job = 'engineer'

### Instruction:

Convert text to sql: HOw many engineers are older than 30? | person : name , age , city , gender , job | personfriend : name , friend , year | personfriend.friend = person.name | personfriend.name = person.name | 

### Response:

select count ( * ) from person where age > 30 and job = 'engineer'

### Instruction:

Convert text to sql: What is the average age for each gender? | person : name , age , city , gender , job | personfriend : name , friend , year | personfriend.friend = person.name | personfriend.name = person.name | 

### Response:

select avg ( age ) , gender from person group by gender

### Instruction:

Convert text to sql: How old is each gender, on average? | person : name , age , city , gender , job | personfriend : name , friend , year | personfriend.friend = person.name | personfriend.name = person.name | 

### Response:

select avg ( age ) , gender from person group by gender

### Instruction:

Convert text to sql: What is average age for different job title? | person : name , age , city , gender , job | personfriend : name , friend , year | personfriend.friend = person.name | personfriend.name = person.name | 

### Response:

select avg ( age ) , job from person group by job

### Instruction:

Convert text to sql: How old is the average person for each job? | person : name , age , city , gender , job | personfriend : name , friend , year | personfriend.friend = person.name | personfriend.name = person.name | 

### Response:

select avg ( age ) , job from person group by job

### Instruction:

Convert text to sql: What is average age of male for different job title? | person : name , age , city , gender , job | personfriend : name , friend , year | personfriend.friend = person.name | personfriend.name = person.name | 

### Response:

select avg ( age ) , job from person where gender = 'male' group by job

### Instruction:

Convert text to sql: What is the average age for a male in each job? | person : name , age , city , gender , job | personfriend : name , friend , year | personfriend.friend = person.name | personfriend.name = person.name | 

### Response:

select avg ( age ) , job from person where gender = 'male' group by job

### Instruction:

Convert text to sql: What is minimum age for different job title? | person : name , age , city , gender , job | personfriend : name , friend , year | personfriend.friend = person.name | personfriend.name = person.name | 

### Response:

select min ( age ) , job from person group by job
### Instruction:

Convert text to sql: How old is the youngest person for each job? | person : name , age , city , gender , job | personfriend : name , friend , year | personfriend.friend = person.name | personfriend.name = person.name | 

### Response:

select min ( age ) , job from person group by job

### Instruction:

Convert text to sql: Find the number of people who is under 40 for each gender. | person : name , age , city , gender , job | personfriend : name , friend , year | personfriend.friend = person.name | personfriend.name = person.name | 

### Response:

select count ( * ) , gender from person where age < 40 group by gender

### Instruction:

Convert text to sql: How many people are under 40 for each gender? | person : name , age , city , gender , job | personfriend : name , friend , year | personfriend.friend = person.name | personfriend.name = person.name | 

### Response:

select count ( * ) , gender from person where age < 40 group by gender

### Instruction:

Convert text to sql: Find the name of people whose age is greater than any engineer sorted by their age. | person : name , age , city , gender , job | personfriend : name , friend , year | personfriend.friend = person.name | personfriend.name = person.name | 

### Response:

select name from person where age > ( select min ( age ) from person where job = 'engineer' ) order by age asc

### Instruction:

Convert text to sql: What is the name of all the people who are older than at least one engineer? Order them by age. | person : name , age , city , gender , job | personfriend : name , friend , year | personfriend.friend = person.name | personfriend.name = person.name | 

### Response:

select name from person where age > ( select min ( age ) from person where job = 'engineer' ) order by age asc

### Instruction:

Convert text to sql: Find the number of people whose age is greater than all engineers. | person : name , age , city , gender , job | personfriend : name , friend , year | personfriend.friend = person.name | personfriend.name = person.name | 

### Response:

select count ( * ) from person where age > ( select max ( age ) from person where job = 'engineer' )

### Instruction:

Convert text to sql: How many people are older than every engineer? | person : name , age , city , gender , job | personfriend : name , friend , year | personfriend.friend = person.name | personfriend.name = person.name | 

### Response:

select count ( * ) from person where age > ( select max ( age ) from person where job = 'engineer' )

### Instruction:

Convert text to sql: list the name, job title of all people ordered by their names. | person : name , age , city , gender , job | personfriend : name , friend , year | personfriend.friend = person.name | personfriend.name = person.name | 

### Response:

select name , job from person order by name asc

### Instruction:

Convert text to sql: What are the names and job titles of every person ordered alphabetically by name? | person : name , age , city , gender , job | personfriend : name , friend , year | personfriend.friend = person.name | personfriend.name = person.name | 

### Response:

select name , job from person order by name asc
### Instruction:

Convert text to sql: Find the names of all person sorted in the descending order using age. | person : name , age , city , gender , job | personfriend : name , friend , year | personfriend.friend = person.name | personfriend.name = person.name | 

### Response:

select name from person order by age desc

### Instruction:

Convert text to sql: What are the names of everybody sorted by age in descending order? | person : name , age , city , gender , job | personfriend : name , friend , year | personfriend.friend = person.name | personfriend.name = person.name | 

### Response:

select name from person order by age desc

### Instruction:

Convert text to sql: Find the name and age of all males in order of their age. | person : name , age , city , gender , job | personfriend : name , friend , year | personfriend.friend = person.name | personfriend.name = person.name | 

### Response:

select name from person where gender = 'male' order by age asc

### Instruction:

Convert text to sql: What is the name and age of every male? Order the results by age. | person : name , age , city , gender , job | personfriend : name , friend , year | personfriend.friend = person.name | personfriend.name = person.name | 

### Response:

select name from person where gender = 'male' order by age asc

### Instruction:

Convert text to sql: Find the name and age of the person who is a friend of both Dan and Alice. | person : name , age , city , gender , job | personfriend : name , friend , year | personfriend.friend = person.name | personfriend.name = person.name | 

### Response:

select person.name , person.age from person join personfriend on person.name = personfriend.name where personfriend.friend = 'Dan' intersect select person.name , person.age from person join personfriend on person.name = personfriend.name where personfriend.friend = 'Alice'

### Instruction:

Convert text to sql: What are the names and ages of every person who is a friend of both Dan and Alice? | person : name , age , city , gender , job | personfriend : name , friend , year | personfriend.friend = person.name | personfriend.name = person.name | 

### Response:

select person.name , person.age from person join personfriend on person.name = personfriend.name where personfriend.friend = 'Dan' intersect select person.name , person.age from person join personfriend on person.name = personfriend.name where personfriend.friend = 'Alice'

### Instruction:

Convert text to sql: Find the name and age of the person who is a friend of Dan or Alice. | person : name , age , city , gender , job | personfriend : name , friend , year | personfriend.friend = person.name | personfriend.name = person.name | 

### Response:

select distinct person.name , person.age from person join personfriend on person.name = personfriend.name where personfriend.friend = 'Dan' or personfriend.friend = 'Alice'
### Instruction:

Convert text to sql: What are the different names and ages of every friend of either Dan or alice? | person : name , age , city , gender , job | personfriend : name , friend , year | personfriend.friend = person.name | personfriend.name = person.name | 

### Response:

select distinct person.name , person.age from person join personfriend on person.name = personfriend.name where personfriend.friend = 'Dan' or personfriend.friend = 'Alice'

### Instruction:

Convert text to sql: Find the name of the person who has friends with age above 40 and under age 30? | person : name , age , city , gender , job | personfriend : name , friend , year | personfriend.friend = person.name | personfriend.name = person.name | 

### Response:

select person.name from person join personfriend on person.name = personfriend.name where personfriend.friend in ( select name from person where age > 40 ) intersect select person.name from person join personfriend on person.name = personfriend.name where personfriend.friend in ( select name from person where age < 30 )

### Instruction:

Convert text to sql: What are the names of every person who has a friend over 40 and under 30? | person : name , age , city , gender , job | personfriend : name , friend , year | personfriend.friend = person.name | personfriend.name = person.name | 

### Response:

select person.name from person join personfriend on person.name = personfriend.name where personfriend.friend in ( select name from person where age > 40 ) intersect select person.name from person join personfriend on person.name = personfriend.name where personfriend.friend in ( select name from person where age < 30 )

### Instruction:

Convert text to sql: Find the name of the person who has friends with age above 40 but not under age 30? | person : name , age , city , gender , job | personfriend : name , friend , year | personfriend.friend = person.name | personfriend.name = person.name | 

### Response:

select person.name from person join personfriend on person.name = personfriend.name where personfriend.friend in ( select name from person where age > 40 ) except select person.name from person join personfriend on person.name = personfriend.name where personfriend.friend in ( select name from person where age < 30 )

### Instruction:

Convert text to sql: What are the names of the people who are older 40 but no friends under age 30? | person : name , age , city , gender , job | personfriend : name , friend , year | personfriend.friend = person.name | personfriend.name = person.name | 

### Response:

select person.name from person join personfriend on person.name = personfriend.name where personfriend.friend in ( select name from person where age > 40 ) except select person.name from person join personfriend on person.name = personfriend.name where personfriend.friend in ( select name from person where age < 30 )
### Instruction:

Convert text to sql: Find the name of the person who has no student friends. | person : name , age , city , gender , job | personfriend : name , friend , year | personfriend.friend = person.name | personfriend.name = person.name | 

### Response:

select name from person except select personfriend.name from person join personfriend on person.name = personfriend.friend where person.job = 'student'

### Instruction:

Convert text to sql: What are the names of the people who have no friends who are students? | person : name , age , city , gender , job | personfriend : name , friend , year | personfriend.friend = person.name | personfriend.name = person.name | 

### Response:

select name from person except select personfriend.name from person join personfriend on person.name = personfriend.friend where person.job = 'student'

### Instruction:

Convert text to sql: Find the person who has exactly one friend. | person : name , age , city , gender , job | personfriend : name , friend , year | personfriend.friend = person.name | personfriend.name = person.name | 

### Response:

select name from personfriend group by name having count ( * ) = 1

### Instruction:

Convert text to sql: What are the names of everybody who has exactly one friend? | person : name , age , city , gender , job | personfriend : name , friend , year | personfriend.friend = person.name | personfriend.name = person.name | 

### Response:

select name from personfriend group by name having count ( * ) = 1

### Instruction:

Convert text to sql: Who are the friends of Bob? | person : name , age , city , gender , job | personfriend : name , friend , year | personfriend.friend = person.name | personfriend.name = person.name | 

### Response:

select personfriend.friend from person join personfriend on person.name = personfriend.name where person.name = 'Bob'

### Instruction:

Convert text to sql: Who are Bob's friends? | person : name , age , city , gender , job | personfriend : name , friend , year | personfriend.friend = person.name | personfriend.name = person.name | 

### Response:

select personfriend.friend from person join personfriend on person.name = personfriend.name where person.name = 'Bob'

### Instruction:

Convert text to sql: Find the name of persons who are friends with Bob. | person : name , age , city , gender , job | personfriend : name , friend , year | personfriend.friend = person.name | personfriend.name = person.name | 

### Response:

select person.name from person join personfriend on person.name = personfriend.name where personfriend.friend = 'Bob'

### Instruction:

Convert text to sql: What are the names of all of Bob's friends? | person : name , age , city , gender , job | personfriend : name , friend , year | personfriend.friend = person.name | personfriend.name = person.name | 

### Response:

select person.name from person join personfriend on person.name = personfriend.name where personfriend.friend = 'Bob'
### Instruction:

Convert text to sql: Find the names of females who are friends with Zach | person : name , age , city , gender , job | personfriend : name , friend , year | personfriend.friend = person.name | personfriend.name = person.name | 

### Response:

select person.name from person join personfriend on person.name = personfriend.name where personfriend.friend = 'Zach' and person.gender = 'female'

### Instruction:

Convert text to sql: What are the names of all females who are friends with Zach? | person : name , age , city , gender , job | personfriend : name , friend , year | personfriend.friend = person.name | personfriend.name = person.name | 

### Response:

select person.name from person join personfriend on person.name = personfriend.name where personfriend.friend = 'Zach' and person.gender = 'female'

### Instruction:

Convert text to sql: Find the female friends of Alice. | person : name , age , city , gender , job | personfriend : name , friend , year | personfriend.friend = person.name | personfriend.name = person.name | 

### Response:

select personfriend.friend from person join personfriend on person.name = personfriend.friend where personfriend.name = 'Alice' and person.gender = 'female'

### Instruction:

Convert text to sql: What are all the friends of Alice who are female? | person : name , age , city , gender , job | personfriend : name , friend , year | personfriend.friend = person.name | personfriend.name = person.name | 

### Response:

select personfriend.friend from person join personfriend on person.name = personfriend.friend where personfriend.name = 'Alice' and person.gender = 'female'

### Instruction:

Convert text to sql: Find the male friend of Alice whose job is a doctor? | person : name , age , city , gender , job | personfriend : name , friend , year | personfriend.friend = person.name | personfriend.name = person.name | 

### Response:

select personfriend.friend from person join personfriend on person.name = personfriend.friend where personfriend.name = 'Alice' and person.gender = 'male' and person.job = 'doctor'

### Instruction:

Convert text to sql: Who are the friends of Alice that are doctors? | person : name , age , city , gender , job | personfriend : name , friend , year | personfriend.friend = person.name | personfriend.name = person.name | 

### Response:

select personfriend.friend from person join personfriend on person.name = personfriend.friend where personfriend.name = 'Alice' and person.gender = 'male' and person.job = 'doctor'

### Instruction:

Convert text to sql: Who has a friend that is from new york city? | person : name , age , city , gender , job | personfriend : name , friend , year | personfriend.friend = person.name | personfriend.name = person.name | 

### Response:

select personfriend.name from person join personfriend on person.name = personfriend.friend where person.city = 'new york city'
### Instruction:

Convert text to sql: What are the names of all friends who are from New York? | person : name , age , city , gender , job | personfriend : name , friend , year | personfriend.friend = person.name | personfriend.name = person.name | 

### Response:

select personfriend.name from person join personfriend on person.name = personfriend.friend where person.city = 'new york city'

### Instruction:

Convert text to sql: Who has friends that are younger than the average age? | person : name , age , city , gender , job | personfriend : name , friend , year | personfriend.friend = person.name | personfriend.name = person.name | 

### Response:

select distinct personfriend.name from person join personfriend on person.name = personfriend.friend where person.age < ( select avg ( age ) from person )

### Instruction:

Convert text to sql: What are the different names of friends who are younger than the average age for a friend? | person : name , age , city , gender , job | personfriend : name , friend , year | personfriend.friend = person.name | personfriend.name = person.name | 

### Response:

select distinct personfriend.name from person join personfriend on person.name = personfriend.friend where person.age < ( select avg ( age ) from person )

### Instruction:

Convert text to sql: Who has friends that are older than the average age? Print their friends and their ages as well | person : name , age , city , gender , job | personfriend : name , friend , year | personfriend.friend = person.name | personfriend.name = person.name | 

### Response:

select distinct personfriend.name , personfriend.friend , person.age from person join personfriend on person.name = personfriend.friend where person.age > ( select avg ( age ) from person )

### Instruction:

Convert text to sql: Whare the names, friends, and ages of all people who are older than the average age of a person? | person : name , age , city , gender , job | personfriend : name , friend , year | personfriend.friend = person.name | personfriend.name = person.name | 

### Response:

select distinct personfriend.name , personfriend.friend , person.age from person join personfriend on person.name = personfriend.friend where person.age > ( select avg ( age ) from person )

### Instruction:

Convert text to sql: Who is the friend of Zach with longest year relationship? | person : name , age , city , gender , job | personfriend : name , friend , year | personfriend.friend = person.name | personfriend.name = person.name | 

### Response:

select friend from personfriend where name = 'Zach' and year = ( select max ( year ) from personfriend where name = 'Zach' )

### Instruction:

Convert text to sql: Which friend of Zach has the longest-lasting friendship? | person : name , age , city , gender , job | personfriend : name , friend , year | personfriend.friend = person.name | personfriend.name = person.name | 

### Response:

select friend from personfriend where name = 'Zach' and year = ( select max ( year ) from personfriend where name = 'Zach' )
### Instruction:

Convert text to sql: What is the age of the friend of Zach with longest year relationship? | person : name , age , city , gender , job | personfriend : name , friend , year | personfriend.friend = person.name | personfriend.name = person.name | 

### Response:

select person.age from person join personfriend on person.name = personfriend.friend where personfriend.name = 'Zach' and personfriend.year = ( select max ( year ) from personfriend where name = 'Zach' )

### Instruction:

Convert text to sql: What are the ages of all of Zach's friends who are in the longest relationship? | person : name , age , city , gender , job | personfriend : name , friend , year | personfriend.friend = person.name | personfriend.name = person.name | 

### Response:

select person.age from person join personfriend on person.name = personfriend.friend where personfriend.name = 'Zach' and personfriend.year = ( select max ( year ) from personfriend where name = 'Zach' )

### Instruction:

Convert text to sql: Find the name of persons who are friends with Alice for the shortest years. | person : name , age , city , gender , job | personfriend : name , friend , year | personfriend.friend = person.name | personfriend.name = person.name | 

### Response:

select name from personfriend where friend = 'Alice' and year = ( select min ( year ) from personfriend where friend = 'Alice' )

### Instruction:

Convert text to sql: What are the names of all people who are friends with Alice for the shortest amount of time? | person : name , age , city , gender , job | personfriend : name , friend , year | personfriend.friend = person.name | personfriend.name = person.name | 

### Response:

select name from personfriend where friend = 'Alice' and year = ( select min ( year ) from personfriend where friend = 'Alice' )

### Instruction:

Convert text to sql: Find the name, age, and job title of persons who are friends with Alice for the longest years. | person : name , age , city , gender , job | personfriend : name , friend , year | personfriend.friend = person.name | personfriend.name = person.name | 

### Response:

select person.name , person.age , person.job from person join personfriend on person.name = personfriend.name where personfriend.friend = 'Alice' and personfriend.year = ( select max ( year ) from personfriend where friend = 'Alice' )

### Instruction:

Convert text to sql: What are the names, ages, and jobs of all people who are friends with Alice for the longest amount of time? | person : name , age , city , gender , job | personfriend : name , friend , year | personfriend.friend = person.name | personfriend.name = person.name | 

### Response:

select person.name , person.age , person.job from person join personfriend on person.name = personfriend.name where personfriend.friend = 'Alice' and personfriend.year = ( select max ( year ) from personfriend where friend = 'Alice' )