db_id
stringlengths
4
31
SQL
stringlengths
18
1.45k
input_sequence
stringlengths
148
11k
question
stringlengths
16
325
network_2
select count(*) from person where gender = 'female'
Question: how many females does this network has? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
how many females does this network has?
network_2
select count(*) from person where gender = 'female'
Question: how many females are in the network? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
how many females are in the network?
network_2
select avg(age) from person
Question: what is the average age for all person? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
what is the average age for all person?
network_2
select avg(age) from person
Question: what is the average age for all people in the table? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
what is the average age for all people in the table?
network_2
select count(distinct city) from person
Question: how many different cities are they from? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
how many different cities are they from?
network_2
select count(distinct city) from person
Question: how many different cities do people originate from? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
how many different cities do people originate from?
network_2
select count(distinct job) from person
Question: how many type of jobs do they have? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
how many type of jobs do they have?
network_2
select count(distinct job) from person
Question: how many different jobs are listed? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
how many different jobs are listed?
network_2
select name from person where age = (select max(age) from person)
Question: who is the oldest person? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
who is the oldest person?
network_2
select name from person where age = (select max(age) from person)
Question: what is the name of the person who is the oldest? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
what is the name of the person who is the oldest?
network_2
select name from person where job = 'student' and age = (select max(age) from person where job = 'student' )
Question: who is the oldest person whose job is student? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
who is the oldest person whose job is student?
network_2
select name from person where job = 'student' and age = (select max(age) from person where job = 'student' )
Question: what is the name of the oldest student? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
what is the name of the oldest student?
network_2
select name from person where gender = 'male' and age = (select min(age) from person where gender = 'male' )
Question: who is the youngest male? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
who is the youngest male?
network_2
select name from person where gender = 'male' and age = (select min(age) from person where gender = 'male' )
Question: what is the name of the youngest male? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
what is the name of the youngest male?
network_2
select age from person where job = 'doctor' and name = 'zach'
Question: how old is the doctor named zach? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
how old is the doctor named zach?
network_2
select age from person where job = 'doctor' and name = 'zach'
Question: what is the age of the doctor named zach? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
what is the age of the doctor named zach?
network_2
select name from person where age < 30
Question: who is the person whose age is below 30? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
who is the person whose age is below 30?
network_2
select name from person where age < 30
Question: what is the name of the person whose age is below 30? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
what is the name of the person whose age is below 30?
network_2
select count(*) from person where age > 30 and job = 'engineer'
Question: how many people whose age is greater 30 and job is engineer? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
how many people whose age is greater 30 and job is engineer?
network_2
select count(*) from person where age > 30 and job = 'engineer'
Question: how many engineers are older than 30? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
how many engineers are older than 30?
network_2
select avg(age) , gender from person group by gender
Question: what is the average age for each gender? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
what is the average age for each gender?
network_2
select avg(age) , gender from person group by gender
Question: how old is each gender, on average? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
how old is each gender, on average?
network_2
select avg(age) , job from person group by job
Question: what is average age for different job title? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
what is average age for different job title?
network_2
select avg(age) , job from person group by job
Question: how old is the average person for each job? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
how old is the average person for each job?
network_2
select avg(age) , job from person where gender = 'male' group by job
Question: what is average age of male for different job title? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
what is average age of male for different job title?
network_2
select avg(age) , job from person where gender = 'male' group by job
Question: what is the average age for a male in each job? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
what is the average age for a male in each job?
network_2
select min(age) , job from person group by job
Question: what is minimum age for different job title? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
what is minimum age for different job title?
network_2
select min(age) , job from person group by job
Question: how old is the youngest person for each job? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
how old is the youngest person for each job?
network_2
select count(*) , gender from person where age < 40 group by gender
Question: find the number of people who is under 40 for each gender. | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
find the number of people who is under 40 for each gender.
network_2
select count(*) , gender from person where age < 40 group by gender
Question: how many people are under 40 for each gender? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
how many people are under 40 for each gender?
network_2
select name from person where age > (select min(age) from person where job = 'engineer') order by age
Question: find the name of people whose age is greater than any engineer sorted by their age. | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
find the name of people whose age is greater than any engineer sorted by their age.
network_2
select name from person where age > (select min(age) from person where job = 'engineer') order by age
Question: what is the name of all the people who are older than at least one engineer? order them by age. | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
what is the name of all the people who are older than at least one engineer? order them by age.
network_2
select count(*) from person where age > (select max(age) from person where job = 'engineer')
Question: find the number of people whose age is greater than all engineers. | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
find the number of people whose age is greater than all engineers.
network_2
select count(*) from person where age > (select max(age) from person where job = 'engineer')
Question: how many people are older than every engineer? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
how many people are older than every engineer?
network_2
select name , job from person order by name
Question: list the name, job title of all people ordered by their names. | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
list the name, job title of all people ordered by their names.
network_2
select name , job from person order by name
Question: what are the names and job titles of every person ordered alphabetically by name? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
what are the names and job titles of every person ordered alphabetically by name?
network_2
select name from person order by age desc
Question: find the names of all person sorted in the descending order using age. | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
find the names of all person sorted in the descending order using age.
network_2
select name from person order by age desc
Question: what are the names of everybody sorted by age in descending order? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
what are the names of everybody sorted by age in descending order?
network_2
select name from person where gender = 'male' order by age
Question: find the name and age of all males in order of their age. | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
find the name and age of all males in order of their age.
network_2
select name from person where gender = 'male' order by age
Question: what is the name and age of every male? order the results by age. | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
what is the name and age of every male? order the results by age.
network_2
select t1.name , t1.age from person as t1 join personfriend as t2 on t1.name = t2.name where t2.friend = 'dan' intersect select t1.name , t1.age from person as t1 join personfriend as t2 on t1.name = t2.name where t2.friend = 'alice'
Question: find the name and age of the person who is a friend of both dan and alice. | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
find the name and age of the person who is a friend of both dan and alice.
network_2
select t1.name , t1.age from person as t1 join personfriend as t2 on t1.name = t2.name where t2.friend = 'dan' intersect select t1.name , t1.age from person as t1 join personfriend as t2 on t1.name = t2.name where t2.friend = 'alice'
Question: what are the names and ages of every person who is a friend of both dan and alice? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
what are the names and ages of every person who is a friend of both dan and alice?
network_2
select distinct t1.name , t1.age from person as t1 join personfriend as t2 on t1.name = t2.name where t2.friend = 'dan' or t2.friend = 'alice'
Question: find the name and age of the person who is a friend of dan or alice. | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
find the name and age of the person who is a friend of dan or alice.
network_2
select distinct t1.name , t1.age from person as t1 join personfriend as t2 on t1.name = t2.name where t2.friend = 'dan' or t2.friend = 'alice'
Question: what are the different names and ages of every friend of either dan or alice? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
what are the different names and ages of every friend of either dan or alice?
network_2
select t1.name from person as t1 join personfriend as t2 on t1.name = t2.name where t2.friend in (select name from person where age > 40) intersect select t1.name from person as t1 join personfriend as t2 on t1.name = t2.name where t2.friend in (select name from person where age < 30)
Question: find the name of the person who has friends with age above 40 and under age 30? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
find the name of the person who has friends with age above 40 and under age 30?
network_2
select t1.name from person as t1 join personfriend as t2 on t1.name = t2.name where t2.friend in (select name from person where age > 40) intersect select t1.name from person as t1 join personfriend as t2 on t1.name = t2.name where t2.friend in (select name from person where age < 30)
Question: what are the names of every person who has a friend over 40 and under 30? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
what are the names of every person who has a friend over 40 and under 30?
network_2
select t1.name from person as t1 join personfriend as t2 on t1.name = t2.name where t2.friend in (select name from person where age > 40) except select t1.name from person as t1 join personfriend as t2 on t1.name = t2.name where t2.friend in (select name from person where age < 30)
Question: find the name of the person who has friends with age above 40 but not under age 30? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
find the name of the person who has friends with age above 40 but not under age 30?
network_2
select t1.name from person as t1 join personfriend as t2 on t1.name = t2.name where t2.friend in (select name from person where age > 40) except select t1.name from person as t1 join personfriend as t2 on t1.name = t2.name where t2.friend in (select name from person where age < 30)
Question: what are the names of the people who are older 40 but no friends under age 30? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
what are the names of the people who are older 40 but no friends under age 30?
network_2
select name from person except select t2.name from person as t1 join personfriend as t2 on t1.name = t2.friend where t1.job = 'student'
Question: find the name of the person who has no student friends. | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
find the name of the person who has no student friends.
network_2
select name from person except select t2.name from person as t1 join personfriend as t2 on t1.name = t2.friend where t1.job = 'student'
Question: what are the names of the people who have no friends who are students? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
what are the names of the people who have no friends who are students?
network_2
select name from personfriend group by name having count(*) = 1
Question: find the person who has exactly one friend. | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
find the person who has exactly one friend.
network_2
select name from personfriend group by name having count(*) = 1
Question: what are the names of everybody who has exactly one friend? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
what are the names of everybody who has exactly one friend?
network_2
select t2.friend from person as t1 join personfriend as t2 on t1.name = t2.name where t1.name = 'bob'
Question: who are the friends of bob? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
who are the friends of bob?
network_2
select t2.friend from person as t1 join personfriend as t2 on t1.name = t2.name where t1.name = 'bob'
Question: who are bob's friends? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
who are bob's friends?
network_2
select t1.name from person as t1 join personfriend as t2 on t1.name = t2.name where t2.friend = 'bob'
Question: find the name of persons who are friends with bob. | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
find the name of persons who are friends with bob.
network_2
select t1.name from person as t1 join personfriend as t2 on t1.name = t2.name where t2.friend = 'bob'
Question: what are the names of all of bob's friends? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
what are the names of all of bob's friends?
network_2
select t1.name from person as t1 join personfriend as t2 on t1.name = t2.name where t2.friend = 'zach' and t1.gender = 'female'
Question: find the names of females who are friends with zach | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
find the names of females who are friends with zach
network_2
select t1.name from person as t1 join personfriend as t2 on t1.name = t2.name where t2.friend = 'zach' and t1.gender = 'female'
Question: what are the names of all females who are friends with zach? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
what are the names of all females who are friends with zach?
network_2
select t2.friend from person as t1 join personfriend as t2 on t1.name = t2.friend where t2.name = 'alice' and t1.gender = 'female'
Question: find the female friends of alice. | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
find the female friends of alice.
network_2
select t2.friend from person as t1 join personfriend as t2 on t1.name = t2.friend where t2.name = 'alice' and t1.gender = 'female'
Question: what are all the friends of alice who are female? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
what are all the friends of alice who are female?
network_2
select t2.friend from person as t1 join personfriend as t2 on t1.name = t2.friend where t2.name = 'alice' and t1.gender = 'male' and t1.job = 'doctor'
Question: find the male friend of alice whose job is a doctor? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
find the male friend of alice whose job is a doctor?
network_2
select t2.friend from person as t1 join personfriend as t2 on t1.name = t2.friend where t2.name = 'alice' and t1.gender = 'male' and t1.job = 'doctor'
Question: who are the friends of alice that are doctors? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
who are the friends of alice that are doctors?
network_2
select t2.name from person as t1 join personfriend as t2 on t1.name = t2.friend where t1.city = 'new york city'
Question: who has a friend that is from new york city? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
who has a friend that is from new york city?
network_2
select t2.name from person as t1 join personfriend as t2 on t1.name = t2.friend where t1.city = 'new york city'
Question: what are the names of all friends who are from new york? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
what are the names of all friends who are from new york?
network_2
select distinct t2.name from person as t1 join personfriend as t2 on t1.name = t2.friend where t1.age < (select avg(age) from person)
Question: who has friends that are younger than the average age? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
who has friends that are younger than the average age?
network_2
select distinct t2.name from person as t1 join personfriend as t2 on t1.name = t2.friend where t1.age < (select avg(age) from person)
Question: what are the different names of friends who are younger than the average age for a friend? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
what are the different names of friends who are younger than the average age for a friend?
network_2
select distinct t2.name , t2.friend , t1.age from person as t1 join personfriend as t2 on t1.name = t2.friend where t1.age > (select avg(age) from person)
Question: who has friends that are older than the average age? print their friends and their ages as well | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
who has friends that are older than the average age? print their friends and their ages as well
network_2
select distinct t2.name , t2.friend , t1.age from person as t1 join personfriend as t2 on t1.name = t2.friend where t1.age > (select avg(age) from person)
Question: whare the names, friends, and ages of all people who are older than the average age of a person? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
whare the names, friends, and ages of all people who are older than the average age of a person?
network_2
select friend from personfriend where name = 'zach' and year = (select max(year) from personfriend where name = 'zach')
Question: who is the friend of zach with longest year relationship? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
who is the friend of zach with longest year relationship?
network_2
select friend from personfriend where name = 'zach' and year = (select max(year) from personfriend where name = 'zach')
Question: which friend of zach has the longest-lasting friendship? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
which friend of zach has the longest-lasting friendship?
network_2
select t1.age from person as t1 join personfriend as t2 on t1.name = t2.friend where t2.name = 'zach' and t2.year = (select max(year) from personfriend where name = 'zach')
Question: what is the age of the friend of zach with longest year relationship? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
what is the age of the friend of zach with longest year relationship?
network_2
select t1.age from person as t1 join personfriend as t2 on t1.name = t2.friend where t2.name = 'zach' and t2.year = (select max(year) from personfriend where name = 'zach')
Question: what are the ages of all of zach's friends who are in the longest relationship? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
what are the ages of all of zach's friends who are in the longest relationship?
network_2
select name from personfriend where friend = 'alice' and year = (select min(year) from personfriend where friend = 'alice')
Question: find the name of persons who are friends with alice for the shortest years. | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
find the name of persons who are friends with alice for the shortest years.
network_2
select name from personfriend where friend = 'alice' and year = (select min(year) from personfriend where friend = 'alice')
Question: what are the names of all people who are friends with alice for the shortest amount of time? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
what are the names of all people who are friends with alice for the shortest amount of time?
network_2
select t1.name , t1.age , t1.job from person as t1 join personfriend as t2 on t1.name = t2.name where t2.friend = 'alice' and t2.year = (select max(year) from personfriend where friend = 'alice')
Question: find the name, age, and job title of persons who are friends with alice for the longest years. | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
find the name, age, and job title of persons who are friends with alice for the longest years.
network_2
select t1.name , t1.age , t1.job from person as t1 join personfriend as t2 on t1.name = t2.name where t2.friend = 'alice' and t2.year = (select max(year) from personfriend where friend = 'alice')
Question: what are the names, ages, and jobs of all people who are friends with alice for the longest amount of time? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
what are the names, ages, and jobs of all people who are friends with alice for the longest amount of time?
network_2
select name from person except select name from personfriend
Question: who is the person that has no friend? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
who is the person that has no friend?
network_2
select name from person except select name from personfriend
Question: what are the names of all people who do not have friends? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
what are the names of all people who do not have friends?
network_2
select t2.name , avg(t1.age) from person as t1 join personfriend as t2 on t1.name = t2.friend group by t2.name order by avg(t1.age) desc limit 1
Question: which person whose friends have the oldest average age? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
which person whose friends have the oldest average age?
network_2
select t2.name , avg(t1.age) from person as t1 join personfriend as t2 on t1.name = t2.friend group by t2.name order by avg(t1.age) desc limit 1
Question: what is the name of the person who has the oldest average age for their friends, and what is that average age? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
what is the name of the person who has the oldest average age for their friends, and what is that average age?
network_2
select count(distinct name) from personfriend where friend not in (select name from person where city = 'austin')
Question: what is the total number of people who has no friend living in the city of austin. | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
what is the total number of people who has no friend living in the city of austin.
network_2
select count(distinct name) from personfriend where friend not in (select name from person where city = 'austin')
Question: what is the total number of people who have no friends living in austin? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
what is the total number of people who have no friends living in austin?
network_2
select distinct t4.name from personfriend as t1 join person as t2 on t1.name = t2.name join personfriend as t3 on t1.friend = t3.name join personfriend as t4 on t3.friend = t4.name where t2.name = 'alice' and t4.name != 'alice'
Question: find alice's friends of friends. | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
find alice's friends of friends.
network_2
select distinct t4.name from personfriend as t1 join person as t2 on t1.name = t2.name join personfriend as t3 on t1.friend = t3.name join personfriend as t4 on t3.friend = t4.name where t2.name = 'alice' and t4.name != 'alice'
Question: what are the names of all of alice's friends of friends? | Tables: Person -> name, age, city, gender, job. PersonFriend -> name, friend, year. | Joins: PersonFriend.friend = Person.name, PersonFriend.name = Person.name,
what are the names of all of alice's friends of friends?
decoration_competition
select count(*) from member
Question: how many members are there? | Tables: college -> College_ID, Name, Leader_Name, College_Location. member -> Member_ID, Name, Country, College_ID. round -> Round_ID, Member_ID, Decoration_Theme, Rank_in_Round. | Joins: member.College_ID = college.College_ID, round.Member_ID = member.Member_ID,
how many members are there?
decoration_competition
select name from member order by name asc
Question: list the names of members in ascending alphabetical order. | Tables: college -> College_ID, Name, Leader_Name, College_Location. member -> Member_ID, Name, Country, College_ID. round -> Round_ID, Member_ID, Decoration_Theme, Rank_in_Round. | Joins: member.College_ID = college.College_ID, round.Member_ID = mem...
list the names of members in ascending alphabetical order.
decoration_competition
select name , country from member
Question: what are the names and countries of members? | Tables: college -> College_ID, Name, Leader_Name, College_Location. member -> Member_ID, Name, Country, College_ID. round -> Round_ID, Member_ID, Decoration_Theme, Rank_in_Round. | Joins: member.College_ID = college.College_ID, round.Member_ID = member.Member_ID,
what are the names and countries of members?
decoration_competition
select name from member where country = 'united states' or country = 'canada'
Question: show the names of members whose country is 'united states' or 'canada'. | Tables: college -> College_ID, Name, Leader_Name, College_Location. member -> Member_ID, Name, Country, College_ID. round -> Round_ID, Member_ID, Decoration_Theme, Rank_in_Round. | Joins: member.College_ID = college.College_ID, round.Me...
show the names of members whose country is 'united states' or 'canada'.
decoration_competition
select country , count(*) from member group by country
Question: show the different countries and the number of members from each. | Tables: college -> College_ID, Name, Leader_Name, College_Location. member -> Member_ID, Name, Country, College_ID. round -> Round_ID, Member_ID, Decoration_Theme, Rank_in_Round. | Joins: member.College_ID = college.College_ID, round.Member_I...
show the different countries and the number of members from each.
decoration_competition
select country from member group by country order by count(*) desc limit 1
Question: show the most common country across members. | Tables: college -> College_ID, Name, Leader_Name, College_Location. member -> Member_ID, Name, Country, College_ID. round -> Round_ID, Member_ID, Decoration_Theme, Rank_in_Round. | Joins: member.College_ID = college.College_ID, round.Member_ID = member.Member_ID,
show the most common country across members.
decoration_competition
select country from member group by country having count(*) > 2
Question: which countries have more than two members? | Tables: college -> College_ID, Name, Leader_Name, College_Location. member -> Member_ID, Name, Country, College_ID. round -> Round_ID, Member_ID, Decoration_Theme, Rank_in_Round. | Joins: member.College_ID = college.College_ID, round.Member_ID = member.Member_ID,
which countries have more than two members?
decoration_competition
select leader_name , college_location from college
Question: show the leader names and locations of colleges. | Tables: college -> College_ID, Name, Leader_Name, College_Location. member -> Member_ID, Name, Country, College_ID. round -> Round_ID, Member_ID, Decoration_Theme, Rank_in_Round. | Joins: member.College_ID = college.College_ID, round.Member_ID = member.Member...
show the leader names and locations of colleges.
decoration_competition
select t2.name , t1.name from college as t1 join member as t2 on t1.college_id = t2.college_id
Question: show the names of members and names of colleges they go to. | Tables: college -> College_ID, Name, Leader_Name, College_Location. member -> Member_ID, Name, Country, College_ID. round -> Round_ID, Member_ID, Decoration_Theme, Rank_in_Round. | Joins: member.College_ID = college.College_ID, round.Member_ID = me...
show the names of members and names of colleges they go to.
decoration_competition
select t2.name , t1.college_location from college as t1 join member as t2 on t1.college_id = t2.college_id order by t2.name asc
Question: show the names of members and the locations of colleges they go to in ascending alphabetical order of member names. | Tables: college -> College_ID, Name, Leader_Name, College_Location. member -> Member_ID, Name, Country, College_ID. round -> Round_ID, Member_ID, Decoration_Theme, Rank_in_Round. | Joins: memb...
show the names of members and the locations of colleges they go to in ascending alphabetical order of member names.
decoration_competition
select distinct t1.leader_name from college as t1 join member as t2 on t1.college_id = t2.college_id where t2.country = 'canada'
Question: show the distinct leader names of colleges associated with members from country 'canada'. | Tables: college -> College_ID, Name, Leader_Name, College_Location. member -> Member_ID, Name, Country, College_ID. round -> Round_ID, Member_ID, Decoration_Theme, Rank_in_Round. | Joins: member.College_ID = college.Co...
show the distinct leader names of colleges associated with members from country 'canada'.
decoration_competition
select t1.name , t2.decoration_theme from member as t1 join round as t2 on t1.member_id = t2.member_id
Question: show the names of members and the decoration themes they have. | Tables: college -> College_ID, Name, Leader_Name, College_Location. member -> Member_ID, Name, Country, College_ID. round -> Round_ID, Member_ID, Decoration_Theme, Rank_in_Round. | Joins: member.College_ID = college.College_ID, round.Member_ID =...
show the names of members and the decoration themes they have.
decoration_competition
select t1.name from member as t1 join round as t2 on t1.member_id = t2.member_id where t2.rank_in_round > 3
Question: show the names of members that have a rank in round higher than 3. | Tables: college -> College_ID, Name, Leader_Name, College_Location. member -> Member_ID, Name, Country, College_ID. round -> Round_ID, Member_ID, Decoration_Theme, Rank_in_Round. | Joins: member.College_ID = college.College_ID, round.Member_...
show the names of members that have a rank in round higher than 3.
decoration_competition
select t1.name from member as t1 join round as t2 on t1.member_id = t2.member_id order by rank_in_round asc
Question: show the names of members in ascending order of their rank in rounds. | Tables: college -> College_ID, Name, Leader_Name, College_Location. member -> Member_ID, Name, Country, College_ID. round -> Round_ID, Member_ID, Decoration_Theme, Rank_in_Round. | Joins: member.College_ID = college.College_ID, round.Memb...
show the names of members in ascending order of their rank in rounds.
decoration_competition
select name from member where member_id not in (select member_id from round)
Question: list the names of members who did not participate in any round. | Tables: college -> College_ID, Name, Leader_Name, College_Location. member -> Member_ID, Name, Country, College_ID. round -> Round_ID, Member_ID, Decoration_Theme, Rank_in_Round. | Joins: member.College_ID = college.College_ID, round.Member_ID ...
list the names of members who did not participate in any round.
document_management
select document_name , access_count from documents order by document_name
Question: find the name and access counts of all documents, in alphabetic order of the document name. | Tables: Roles -> role_code, role_description. Users -> user_id, role_code, user_name, user_login, password. Document_Structures -> document_structure_code, parent_document_structure_code, document_structure_descripti...
find the name and access counts of all documents, in alphabetic order of the document name.