target-benchmark/spider-queries huggingface dataset:
Database: tracking_grants_for_research (tables: organisations, organisation_types)
Question: What are all the details of the organisations described as 'Sponsor'? Sort the result in an ascending order.
SQL: SELECT organisation_details FROM Organisations AS T1 JOIN organisation_Types AS T2 ON T1.organisation_type  =  T2.organisation_type WHERE T2.organisation_type_description  =  'Sponsor' ORDER BY organisation_details
Database: tracking_grants_for_research (tables: organisations, organisation_types)
Question: What are the details of all organizations that are described as Sponsors and sort the results in ascending order?
SQL: SELECT organisation_details FROM Organisations AS T1 JOIN organisation_Types AS T2 ON T1.organisation_type  =  T2.organisation_type WHERE T2.organisation_type_description  =  'Sponsor' ORDER BY organisation_details
Database: tracking_grants_for_research (tables: project_outcomes)
Question: How many Patent outcomes are generated from all the projects?
SQL: SELECT count(*) FROM Project_outcomes WHERE outcome_code  =  'Patent'
Database: tracking_grants_for_research (tables: project_outcomes)
Question: How many patents outcomes were listed for all the projects?
SQL: SELECT count(*) FROM Project_outcomes WHERE outcome_code  =  'Patent'
Database: tracking_grants_for_research (tables: project_staff)
Question: How many project staff worked as leaders or started working before '1989-04-24 23:51:54'?
SQL: SELECT count(*) FROM Project_Staff WHERE role_code  =  'leader' OR date_from  <  '1989-04-24 23:51:54'
Database: tracking_grants_for_research (tables: project_staff)
Question: How many project members were leaders or started working before '1989-04-24 23:51:54'?
SQL: SELECT count(*) FROM Project_Staff WHERE role_code  =  'leader' OR date_from  <  '1989-04-24 23:51:54'
Database: tracking_grants_for_research (tables: project_staff)
Question: What is the last date of the staff leaving the projects?
SQL: SELECT date_to FROM Project_Staff ORDER BY date_to DESC LIMIT 1
Database: tracking_grants_for_research (tables: project_staff)
Question: What is the last date that a staff member left a project?
SQL: SELECT date_to FROM Project_Staff ORDER BY date_to DESC LIMIT 1
Database: tracking_grants_for_research (tables: research_outcomes, projects, project_outcomes)
Question: What are the result description of the project whose detail is 'sint'?
SQL: SELECT T1.outcome_description FROM Research_outcomes AS T1 JOIN Project_outcomes AS T2 ON T1.outcome_code  =  T2.outcome_code JOIN Projects AS T3 ON T2.project_id  =  T3.project_id WHERE T3.project_details  =  'sint'
Database: tracking_grants_for_research (tables: research_outcomes, projects, project_outcomes)
Question: What is the description for the results whose project detail is 'sint'?
SQL: SELECT T1.outcome_description FROM Research_outcomes AS T1 JOIN Project_outcomes AS T2 ON T1.outcome_code  =  T2.outcome_code JOIN Projects AS T3 ON T2.project_id  =  T3.project_id WHERE T3.project_details  =  'sint'
Database: tracking_grants_for_research (tables: project_outcomes, projects)
Question: List the organisation id with the maximum outcome count, and the count.
SQL: SELECT T1.organisation_id ,  count(*) FROM Projects AS T1 JOIN Project_outcomes AS T2 ON T1.project_id  =  T2.project_id GROUP BY T1.organisation_id ORDER BY count(*) DESC LIMIT 1
Database: tracking_grants_for_research (tables: project_outcomes, projects)
Question: What is the id of the organization with the maximum number of outcomes and how many outcomes are there?
SQL: SELECT T1.organisation_id ,  count(*) FROM Projects AS T1 JOIN Project_outcomes AS T2 ON T1.project_id  =  T2.project_id GROUP BY T1.organisation_id ORDER BY count(*) DESC LIMIT 1
Database: tracking_grants_for_research (tables: projects)
Question: List the project details of the projects launched by the organisation
SQL: SELECT project_details FROM Projects WHERE organisation_id IN ( SELECT organisation_id FROM Projects GROUP BY organisation_id ORDER BY count(*) DESC LIMIT 1 )
Database: tracking_grants_for_research (tables: projects)
Question: What are the details for the projects which were launched by the organization with the most projects?
SQL: SELECT project_details FROM Projects WHERE organisation_id IN ( SELECT organisation_id FROM Projects GROUP BY organisation_id ORDER BY count(*) DESC LIMIT 1 )
Database: tracking_grants_for_research (tables: research_staff)
Question: List the research staff details, and order in ascending order.
SQL: SELECT staff_details FROM Research_Staff ORDER BY staff_details ASC
Database: tracking_grants_for_research (tables: research_staff)
Question: What details are there on the research staff? List the result in ascending alphabetical order.
SQL: SELECT staff_details FROM Research_Staff ORDER BY staff_details ASC
Database: tracking_grants_for_research (tables: tasks)
Question: How many tasks are there in total?
SQL: SELECT count(*) FROM Tasks
Database: tracking_grants_for_research (tables: tasks)
Question: How many tasks are there?
SQL: SELECT count(*) FROM Tasks
Database: tracking_grants_for_research (tables: tasks, projects)
Question: How many tasks does each project have? List the task count and the project detail.
SQL: SELECT count(*) ,  T1.project_details FROM Projects AS T1 JOIN Tasks AS T2 ON T1.project_id  =  T2.project_id GROUP BY T1.project_id
Database: tracking_grants_for_research (tables: tasks, projects)
Question: For each project id, how many tasks are there?
SQL: SELECT count(*) ,  T1.project_details FROM Projects AS T1 JOIN Tasks AS T2 ON T1.project_id  =  T2.project_id GROUP BY T1.project_id
Database: tracking_grants_for_research (tables: project_staff)
Question: What are the staff roles of the staff who
SQL: SELECT role_code FROM Project_Staff WHERE date_from  >  '2003-04-19 15:06:20' AND date_to  <  '2016-03-15 00:33:18'
Database: tracking_grants_for_research (tables: project_staff)
Question: What roles did staff members play between '2003-04-19 15:06:20' and '2016-03-15 00:33:18'?
SQL: SELECT role_code FROM Project_Staff WHERE date_from  >  '2003-04-19 15:06:20' AND date_to  <  '2016-03-15 00:33:18'
Database: tracking_grants_for_research (tables: research_outcomes, project_outcomes)
Question: What are the descriptions of all the project outcomes?
SQL: SELECT T1.outcome_description FROM Research_outcomes AS T1 JOIN Project_outcomes AS T2 ON T1.outcome_code  =  T2.outcome_code
Database: tracking_grants_for_research (tables: research_outcomes, project_outcomes)
Question: List the description of the outcomes for all projects.
SQL: SELECT T1.outcome_description FROM Research_outcomes AS T1 JOIN Project_outcomes AS T2 ON T1.outcome_code  =  T2.outcome_code
Database: tracking_grants_for_research (tables: project_staff)
Question: Which role is most common for the staff?
SQL: SELECT role_code FROM Project_Staff GROUP BY role_code ORDER BY count(*) DESC LIMIT 1
Database: tracking_grants_for_research (tables: project_staff)
Question: What is the most common role for the staff?
SQL: SELECT role_code FROM Project_Staff GROUP BY role_code ORDER BY count(*) DESC LIMIT 1
Database: network_2 (tables: personfriend, person)
Question: How many friends does Dan have?
SQL: SELECT count(T2.friend) FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name  =  T2.name WHERE T1.name  =  'Dan'
Database: network_2 (tables: person)
Question: How many females does this network has?
SQL: SELECT count(*) FROM Person WHERE gender  =  'female'
Database: network_2 (tables: person)
Question: How many females are in the network?
SQL: SELECT count(*) FROM Person WHERE gender  =  'female'
Database: network_2 (tables: person)
Question: What is the average age for all person?
SQL: SELECT avg(age) FROM Person
Database: network_2 (tables: person)
Question: What is the average age for all people in the table?
SQL: SELECT avg(age) FROM Person
Database: network_2 (tables: person)
Question: How many different cities are they from?
SQL: SELECT count(DISTINCT city) FROM Person
Database: network_2 (tables: person)
Question: How many different cities do people originate from?
SQL: SELECT count(DISTINCT city) FROM Person
Database: network_2 (tables: person)
Question: How many type of jobs do they have?
SQL: SELECT count(DISTINCT job) FROM Person
Database: network_2 (tables: person)
Question: How many different jobs are listed?
SQL: SELECT count(DISTINCT job) FROM Person
Database: network_2 (tables: person, person)
Question: Who is the oldest person?
SQL: SELECT name FROM Person WHERE age  =  (SELECT max(age) FROM person)
Database: network_2 (tables: person, person)
Question: What is the name of the person who is the oldest?
SQL: SELECT name FROM Person WHERE age  =  (SELECT max(age) FROM person)
Database: network_2 (tables: person, person)
Question: Who is the oldest person whose job is student?
SQL: SELECT name FROM Person WHERE job  =  'student' AND age  =  (SELECT max(age) FROM person WHERE job  =  'student' )
Database: network_2 (tables: person, person)
Question: What is the name of the oldest student?
SQL: SELECT name FROM Person WHERE job  =  'student' AND age  =  (SELECT max(age) FROM person WHERE job  =  'student' )
Database: network_2 (tables: person, person)
Question: Who is the youngest male?
SQL: SELECT name FROM Person WHERE gender  =  'male' AND age  =  (SELECT min(age) FROM person WHERE gender  =  'male' )
Database: network_2 (tables: person, person)
Question: What is the name of the youngest male?
SQL: SELECT name FROM Person WHERE gender  =  'male' AND age  =  (SELECT min(age) FROM person WHERE gender  =  'male' )
Database: network_2 (tables: person)
Question: How old is the doctor named Zach?
SQL: SELECT age FROM Person WHERE job  =  'doctor' AND name  =  'Zach'
Database: network_2 (tables: person)
Question: What is the age of the doctor named Zach?
SQL: SELECT age FROM Person WHERE job  =  'doctor' AND name  =  'Zach'
Database: network_2 (tables: person)
Question: Who is the person whose age is below 30?
SQL: SELECT name FROM Person WHERE age  <  30
Database: network_2 (tables: person)
Question: What is the name of the person whose age is below 30?
SQL: SELECT name FROM Person WHERE age  <  30
Database: network_2 (tables: person)
Question: How many people whose age is greater 30 and job is engineer?
SQL: SELECT count(*) FROM Person WHERE age  >  30 AND job  =  'engineer'
Database: network_2 (tables: person)
Question: HOw many engineers are older than 30?
SQL: SELECT count(*) FROM Person WHERE age  >  30 AND job  =  'engineer'
Database: network_2 (tables: person)
Question: What is the average age for each gender?
SQL: SELECT avg(age) ,  gender FROM Person GROUP BY gender
Database: network_2 (tables: person)
Question: How old is each gender, on average?
SQL: SELECT avg(age) ,  gender FROM Person GROUP BY gender
Database: network_2 (tables: person)
Question: What is average age for different job title?
SQL: SELECT avg(age) ,  job FROM Person GROUP BY job
Database: network_2 (tables: person)
Question: How old is the average person for each job?
SQL: SELECT avg(age) ,  job FROM Person GROUP BY job
Database: network_2 (tables: person)
Question: What is average age of male for different job title?
SQL: SELECT avg(age) ,  job FROM Person WHERE gender  =  'male' GROUP BY job
Database: network_2 (tables: person)
Question: What is the average age for a male in each job?
SQL: SELECT avg(age) ,  job FROM Person WHERE gender  =  'male' GROUP BY job
Database: network_2 (tables: person)
Question: What is minimum age for different job title?
SQL: SELECT min(age) ,  job FROM Person GROUP BY job
Database: network_2 (tables: person)
Question: How old is the youngest person for each job?
SQL: SELECT min(age) ,  job FROM Person GROUP BY job
Database: network_2 (tables: person)
Question: Find the number of people who is under 40 for each gender.
SQL: SELECT count(*) ,  gender FROM Person WHERE age  <  40 GROUP BY gender
Database: network_2 (tables: person)
Question: How many people are under 40 for each gender?
SQL: SELECT count(*) ,  gender FROM Person WHERE age  <  40 GROUP BY gender
Database: network_2 (tables: person, person)
Question: Find the name of people whose age is greater than any engineer sorted by their age.
SQL: SELECT name FROM Person WHERE age  >  (SELECT min(age) FROM person WHERE job  =  'engineer') ORDER BY age
Database: network_2 (tables: person, person)
Question: What is the name of all the people who are older than at least one engineer? Order them by age.
SQL: SELECT name FROM Person WHERE age  >  (SELECT min(age) FROM person WHERE job  =  'engineer') ORDER BY age
Database: network_2 (tables: person, person)
Question: Find the number of people whose age is greater than all engineers.
SQL: SELECT count(*) FROM Person WHERE age  >  (SELECT max(age) FROM person WHERE job  =  'engineer')
Database: network_2 (tables: person, person)
Question: How many people are older than every engineer?
SQL: SELECT count(*) FROM Person WHERE age  >  (SELECT max(age) FROM person WHERE job  =  'engineer')
Database: network_2 (tables: person)
Question: list the name, job title of all people ordered by their names.
SQL: SELECT name ,  job FROM Person ORDER BY name
Database: network_2 (tables: person)
Question: What are the names and job titles of every person ordered alphabetically by name?
SQL: SELECT name ,  job FROM Person ORDER BY name
Database: network_2 (tables: person)
Question: Find the names of all person sorted in the descending order using age.
SQL: SELECT name FROM Person ORDER BY age DESC
Database: network_2 (tables: person)
Question: What are the names of everybody sorted by age in descending order?
SQL: SELECT name FROM Person ORDER BY age DESC
Database: network_2 (tables: person)
Question: Find the name and age of all males in order of their age.
SQL: SELECT name FROM Person WHERE gender  =  'male' ORDER BY age
Database: network_2 (tables: person)
Question: What is the name and age of every male? Order the results by age.
SQL: SELECT name FROM Person WHERE gender  =  'male' ORDER BY age
Database: network_2 (tables: personfriend, person)
Question: Find the name and age of the person who is a friend of both Dan and Alice.
SQL: 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'
Database: network_2 (tables: personfriend, person)
Question: What are the names and ages of every person who is a friend of both Dan and Alice?
SQL: 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'
Database: network_2 (tables: personfriend, person)
Question: Find the name and age of the person who is a friend of Dan or Alice.
SQL: 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'
Database: network_2 (tables: personfriend, person)
Question: What are the different names and ages of every friend of either Dan or alice?
SQL: 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'
Database: network_2 (tables: personfriend, person)
Question: Find the name of the person who has friends with age above 40 and under age 30?
SQL: 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)
Database: network_2 (tables: personfriend, person)
Question: What are the names of every person who has a friend over 40 and under 30?
SQL: 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)
Database: network_2 (tables: personfriend, person)
Question: Find the name of the person who has friends with age above 40 but not under age 30?
SQL: 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)
Database: network_2 (tables: personfriend, person)
Question: What are the names of the people who are older 40 but no friends under age 30?
SQL: 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)
Database: network_2 (tables: personfriend, person, person)
Question: Find the name of the person who has no student friends.
SQL: 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'
Database: network_2 (tables: personfriend, person, person)
Question: What are the names of the people who have no friends who are students?
SQL: 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'
Database: network_2 (tables: personfriend)
Question: Find the person who has exactly one friend.
SQL: SELECT name FROM PersonFriend GROUP BY name HAVING count(*)  =  1
Database: network_2 (tables: personfriend)
Question: What are the names of everybody who has exactly one friend?
SQL: SELECT name FROM PersonFriend GROUP BY name HAVING count(*)  =  1
Database: network_2 (tables: personfriend, person)
Question: Who are the friends of Bob?
SQL: SELECT T2.friend FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name  =  T2.name WHERE T1.name  =  'Bob'
Database: network_2 (tables: personfriend, person)
Question: Who are Bob's friends?
SQL: SELECT T2.friend FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name  =  T2.name WHERE T1.name  =  'Bob'
Database: network_2 (tables: personfriend, person)
Question: Find the name of persons who are friends with Bob.
SQL: SELECT T1.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name  =  T2.name WHERE T2.friend  =  'Bob'
Database: network_2 (tables: personfriend, person)
Question: What are the names of all of Bob's friends?
SQL: SELECT T1.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name  =  T2.name WHERE T2.friend  =  'Bob'
Database: network_2 (tables: personfriend, person)
Question: Find the names of females who are friends with Zach
SQL: SELECT T1.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name  =  T2.name WHERE T2.friend  =  'Zach' AND T1.gender  =  'female'
Database: network_2 (tables: personfriend, person)
Question: What are the names of all females who are friends with Zach?
SQL: SELECT T1.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name  =  T2.name WHERE T2.friend  =  'Zach' AND T1.gender  =  'female'
Database: network_2 (tables: personfriend, person)
Question: Find the female friends of Alice.
SQL: SELECT T2.friend FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name  =  T2.friend WHERE T2.name  =  'Alice' AND T1.gender  =  'female'
Database: network_2 (tables: personfriend, person)
Question: What are all the friends of Alice who are female?
SQL: SELECT T2.friend FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name  =  T2.friend WHERE T2.name  =  'Alice' AND T1.gender  =  'female'
Database: network_2 (tables: personfriend, person)
Question: Find the male friend of Alice whose job is a doctor?
SQL: 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'
Database: network_2 (tables: personfriend, person)
Question: Who are the friends of Alice that are doctors?
SQL: 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'
Database: network_2 (tables: personfriend, person)
Question: Who has a friend that is from new york city?
SQL: SELECT T2.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name  =  T2.friend WHERE T1.city  =  'new york city'
Database: network_2 (tables: personfriend, person)
Question: What are the names of all friends who are from New York?
SQL: SELECT T2.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name  =  T2.friend WHERE T1.city  =  'new york city'
Database: network_2 (tables: personfriend, person, person)
Question: Who has friends that are younger than the average age?
SQL: 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)
Database: network_2 (tables: personfriend, person, person)
Question: What are the different names of friends who are younger than the average age for a friend?
SQL: 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)
Database: network_2 (tables: personfriend, person, person)
Question: Who has friends that are older than the average age? Print their friends and their ages as well
SQL: 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)
Database: network_2 (tables: personfriend, person, person)
Question: Whare the names, friends, and ages of all people who are older than the average age of a person?
SQL: 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)
Database: network_2 (tables: personfriend)
Question: Who is the friend of Zach with longest year relationship?
SQL: SELECT friend FROM PersonFriend WHERE name =  'Zach' AND YEAR  =  (SELECT max(YEAR) FROM PersonFriend WHERE name =  'Zach')
Database: network_2 (tables: personfriend)
Question: Which friend of Zach has the longest-lasting friendship?
SQL: SELECT friend FROM PersonFriend WHERE name =  'Zach' AND YEAR  =  (SELECT max(YEAR) FROM PersonFriend WHERE name =  'Zach')
Database: network_2 (tables: personfriend, person)
Question: What is the age of the friend of Zach with longest year relationship?
SQL: 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')
Database: network_2 (tables: personfriend, person)
Question: What are the ages of all of Zach's friends who are in the longest relationship?
SQL: 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')
Database: network_2 (tables: personfriend)
Question: Find the name of persons who are friends with Alice for the shortest years.
SQL: SELECT name FROM PersonFriend WHERE friend =  'Alice' AND YEAR  =  (SELECT min(YEAR) FROM PersonFriend WHERE friend =  'Alice')
Database: network_2 (tables: personfriend)
Question: What are the names of all people who are friends with Alice for the shortest amount of time?
SQL: SELECT name FROM PersonFriend WHERE friend =  'Alice' AND YEAR  =  (SELECT min(YEAR) FROM PersonFriend WHERE friend =  'Alice')
Database: network_2 (tables: personfriend, person)
Question: Find the name, age, and job title of persons who are friends with Alice for the longest years.
SQL: 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')