minktn/spider-data huggingface dataset:
Database: tracking_grants_for_research
Question: What are the task details, task id and project id for the projects which are detailed as 'omnis' or  have more than 2 outcomes?
SQL: SELECT T1.task_details ,  T1.task_id ,  T2.project_id FROM Tasks AS T1 JOIN Projects AS T2 ON T1.project_id  =  T2.project_id WHERE T2.project_details  =  'omnis' UNION SELECT T1.task_details ,  T1.task_id ,  T2.project_id FROM Tasks AS T1 JOIN Projects AS T2 ON T1.project_id  =  T2.project_id JOIN Project_outcomes AS T3 ON T2.project_id  =  T3.project_id GROUP BY T2.project_id HAVING count(*)  >  2
Database: tracking_grants_for_research
Question: What are the task details, task ids, and project ids for the progrects that are detailed as 'omnis' or have at least 3 outcomes?
SQL: SELECT T1.task_details ,  T1.task_id ,  T2.project_id FROM Tasks AS T1 JOIN Projects AS T2 ON T1.project_id  =  T2.project_id WHERE T2.project_details  =  'omnis' UNION SELECT T1.task_details ,  T1.task_id ,  T2.project_id FROM Tasks AS T1 JOIN Projects AS T2 ON T1.project_id  =  T2.project_id JOIN Project_outcomes AS T3 ON T2.project_id  =  T3.project_id GROUP BY T2.project_id HAVING count(*)  >  2
Database: tracking_grants_for_research
Question: When do all the researcher role staff start to work, and when do they stop working?
SQL: SELECT date_from ,  date_to FROM Project_Staff WHERE role_code  =  'researcher'
Database: tracking_grants_for_research
Question: When did researchers start and stop working?
SQL: SELECT date_from ,  date_to FROM Project_Staff WHERE role_code  =  'researcher'
Database: tracking_grants_for_research
Question: How many kinds of roles are there for the staff?
SQL: SELECT count(DISTINCT role_code) FROM Project_Staff
Database: tracking_grants_for_research
Question: How many different roles are there on the project staff?
SQL: SELECT count(DISTINCT role_code) FROM Project_Staff
Database: tracking_grants_for_research
Question: What is the total amount of grants given by each organisations? Also list the organisation id.
SQL: SELECT sum(grant_amount) ,  organisation_id FROM Grants GROUP BY organisation_id
Database: tracking_grants_for_research
Question: What is the total amount of grant money given to each organization and what is its id?
SQL: SELECT sum(grant_amount) ,  organisation_id FROM Grants GROUP BY organisation_id
Database: tracking_grants_for_research
Question: List the project details of the projects with the research outcome described with the substring 'Published'.
SQL: SELECT T1.project_details FROM Projects AS T1 JOIN Project_outcomes AS T2 ON T1.project_id  =  T2.project_id JOIN Research_outcomes AS T3 ON T2.outcome_code  =  T3.outcome_code WHERE T3.outcome_description LIKE '%Published%'
Database: tracking_grants_for_research
Question: What are the details for the project whose research has been published?
SQL: SELECT T1.project_details FROM Projects AS T1 JOIN Project_outcomes AS T2 ON T1.project_id  =  T2.project_id JOIN Research_outcomes AS T3 ON T2.outcome_code  =  T3.outcome_code WHERE T3.outcome_description LIKE '%Published%'
Database: tracking_grants_for_research
Question: How many staff does each project has? List the project id and the number in an ascending order.
SQL: SELECT T1.project_id ,  count(*) FROM Project_Staff AS T1 JOIN Projects AS T2 ON T1.project_id  =  T2.project_id GROUP BY T1.project_id ORDER BY count(*) ASC
Database: tracking_grants_for_research
Question: For each project id, how many staff does it have? List them in increasing order.
SQL: SELECT T1.project_id ,  count(*) FROM Project_Staff AS T1 JOIN Projects AS T2 ON T1.project_id  =  T2.project_id GROUP BY T1.project_id ORDER BY count(*) ASC
Database: tracking_grants_for_research
Question: What is the complete description of the researcher role.
SQL: SELECT role_description FROM Staff_Roles WHERE role_code  =  'researcher'
Database: tracking_grants_for_research
Question: What is the complete description of the job of a researcher?
SQL: SELECT role_description FROM Staff_Roles WHERE role_code  =  'researcher'
Database: tracking_grants_for_research
Question: When did the first staff for the projects started working?
SQL: SELECT date_from FROM Project_Staff ORDER BY date_from ASC LIMIT 1
Database: tracking_grants_for_research
Question: When did the first staff member start working?
SQL: SELECT date_from FROM Project_Staff ORDER BY date_from ASC LIMIT 1
Database: tracking_grants_for_research
Question: Which project made the most number of outcomes? List the project details and the project id.
SQL: SELECT T1.project_details ,  T1.project_id FROM Projects AS T1 JOIN Project_outcomes AS T2 ON T1.project_id  =  T2.project_id GROUP BY T1.project_id ORDER BY count(*) DESC LIMIT 1
Database: tracking_grants_for_research
Question: What are the details and id of the project with the most outcomes?
SQL: SELECT T1.project_details ,  T1.project_id FROM Projects AS T1 JOIN Project_outcomes AS T2 ON T1.project_id  =  T2.project_id GROUP BY T1.project_id ORDER BY count(*) DESC LIMIT 1
Database: tracking_grants_for_research
Question: Which projects have no outcome? List the project details.
SQL: SELECT project_details FROM Projects WHERE project_id NOT IN ( SELECT project_id FROM Project_outcomes )
Database: tracking_grants_for_research
Question: What are the details of the project with no outcomes?
SQL: SELECT project_details FROM Projects WHERE project_id NOT IN ( SELECT project_id FROM Project_outcomes )
Database: tracking_grants_for_research
Question: Which organisation hired the most number of research staff? List the organisation id, type and detail.
SQL: SELECT T1.organisation_id ,  T1.organisation_type ,  T1.organisation_details FROM Organisations AS T1 JOIN Research_Staff AS T2 ON T1.organisation_id  =  T2.employer_organisation_id GROUP BY T1.organisation_id ORDER BY count(*) DESC LIMIT 1
Database: tracking_grants_for_research
Question: What are the ids, types, and details of the organization with the most research staff?
SQL: SELECT T1.organisation_id ,  T1.organisation_type ,  T1.organisation_details FROM Organisations AS T1 JOIN Research_Staff AS T2 ON T1.organisation_id  =  T2.employer_organisation_id GROUP BY T1.organisation_id ORDER BY count(*) DESC LIMIT 1
Database: tracking_grants_for_research
Question: Show the role description and the id of the project staff involved in most number of project outcomes?
SQL: SELECT T1.role_description ,  T2.staff_id FROM Staff_Roles AS T1 JOIN Project_Staff AS T2 ON T1.role_code  =  T2.role_code JOIN Project_outcomes AS T3 ON T2.project_id  =  T3.project_id GROUP BY T2.staff_id ORDER BY count(*) DESC LIMIT 1
Database: tracking_grants_for_research
Question: For each staff id, what is the description of the role that is involved with the most number of projects?
SQL: SELECT T1.role_description ,  T2.staff_id FROM Staff_Roles AS T1 JOIN Project_Staff AS T2 ON T1.role_code  =  T2.role_code JOIN Project_outcomes AS T3 ON T2.project_id  =  T3.project_id GROUP BY T2.staff_id ORDER BY count(*) DESC LIMIT 1
Database: tracking_grants_for_research
Question: Which document type is described with the prefix 'Initial'?
SQL: SELECT document_type_code FROM Document_Types WHERE document_description LIKE 'Initial%'
Database: tracking_grants_for_research
Question: What is the type of the document whose description starts with the word 'Initial'?
SQL: SELECT document_type_code FROM Document_Types WHERE document_description LIKE 'Initial%'
Database: tracking_grants_for_research
Question: For grants with both documents described as 'Regular' and documents described as 'Initial Application', list its start date.
SQL: SELECT T1.grant_start_date FROM Grants AS T1 JOIN Documents AS T2 ON T1.grant_id  =  T2.grant_id JOIN Document_Types AS T3 ON T2.document_type_code  =  T3.document_type_code WHERE T3.document_description  =  'Regular' INTERSECT SELECT T1.grant_start_date FROM Grants AS T1 JOIN Documents AS T2 ON T1.grant_id  =  T2.grant_id JOIN Document_Types AS T3 ON T2.document_type_code  =  T3.document_type_code WHERE T3.document_description  =  'Initial Application'
Database: tracking_grants_for_research
Question: For grants that have descriptions of Regular and Initial Applications, what are their start dates?
SQL: SELECT T1.grant_start_date FROM Grants AS T1 JOIN Documents AS T2 ON T1.grant_id  =  T2.grant_id JOIN Document_Types AS T3 ON T2.document_type_code  =  T3.document_type_code WHERE T3.document_description  =  'Regular' INTERSECT SELECT T1.grant_start_date FROM Grants AS T1 JOIN Documents AS T2 ON T1.grant_id  =  T2.grant_id JOIN Document_Types AS T3 ON T2.document_type_code  =  T3.document_type_code WHERE T3.document_description  =  'Initial Application'
Database: tracking_grants_for_research
Question: How many documents can one grant have at most? List the grant id and number.
SQL: SELECT grant_id ,  count(*) FROM Documents GROUP BY grant_id ORDER BY count(*) DESC LIMIT 1
Database: tracking_grants_for_research
Question: For each grant id, how many documents does it have, and which one has the most?
SQL: SELECT grant_id ,  count(*) FROM Documents GROUP BY grant_id ORDER BY count(*) DESC LIMIT 1
Database: tracking_grants_for_research
Question: Find the organisation type description of the organisation detailed as 'quo'.
SQL: SELECT T1.organisation_type_description FROM organisation_Types AS T1 JOIN Organisations AS T2 ON T1.organisation_type  =  T2.organisation_type WHERE T2.organisation_details  =  'quo'
Database: tracking_grants_for_research
Question: What is the type description of the organization whose detail is listed as 'quo'?
SQL: SELECT T1.organisation_type_description FROM organisation_Types AS T1 JOIN Organisations AS T2 ON T1.organisation_type  =  T2.organisation_type WHERE T2.organisation_details  =  'quo'
Database: tracking_grants_for_research
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Question: How many tasks are there in total?
SQL: SELECT count(*) FROM Tasks
Database: tracking_grants_for_research
Question: How many tasks are there?
SQL: SELECT count(*) FROM Tasks
Database: tracking_grants_for_research
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
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
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
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
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
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
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
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
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
Question: How many females does this network has?
SQL: SELECT count(*) FROM Person WHERE gender  =  'female'
Database: network_2
Question: How many females are in the network?
SQL: SELECT count(*) FROM Person WHERE gender  =  'female'
Database: network_2
Question: What is the average age for all person?
SQL: SELECT avg(age) FROM Person
Database: network_2
Question: What is the average age for all people in the table?
SQL: SELECT avg(age) FROM Person
Database: network_2
Question: How many different cities are they from?
SQL: SELECT count(DISTINCT city) FROM Person
Database: network_2
Question: How many different cities do people originate from?
SQL: SELECT count(DISTINCT city) FROM Person
Database: network_2
Question: How many type of jobs do they have?
SQL: SELECT count(DISTINCT job) FROM Person
Database: network_2
Question: How many different jobs are listed?
SQL: SELECT count(DISTINCT job) FROM Person
Database: network_2
Question: Who is the oldest person?
SQL: SELECT name FROM Person WHERE age  =  (SELECT max(age) FROM person)
Database: network_2
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
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
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
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
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
Question: How old is the doctor named Zach?
SQL: SELECT age FROM Person WHERE job  =  'doctor' AND name  =  'Zach'
Database: network_2
Question: What is the age of the doctor named Zach?
SQL: SELECT age FROM Person WHERE job  =  'doctor' AND name  =  'Zach'
Database: network_2
Question: Who is the person whose age is below 30?
SQL: SELECT name FROM Person WHERE age  <  30
Database: network_2
Question: What is the name of the person whose age is below 30?
SQL: SELECT name FROM Person WHERE age  <  30
Database: network_2
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
Question: HOw many engineers are older than 30?
SQL: SELECT count(*) FROM Person WHERE age  >  30 AND job  =  'engineer'
Database: network_2
Question: What is the average age for each gender?
SQL: SELECT avg(age) ,  gender FROM Person GROUP BY gender
Database: network_2
Question: How old is each gender, on average?
SQL: SELECT avg(age) ,  gender FROM Person GROUP BY gender
Database: network_2
Question: What is average age for different job title?
SQL: SELECT avg(age) ,  job FROM Person GROUP BY job
Database: network_2
Question: How old is the average person for each job?
SQL: SELECT avg(age) ,  job FROM Person GROUP BY job
Database: network_2
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
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
Question: What is minimum age for different job title?
SQL: SELECT min(age) ,  job FROM Person GROUP BY job
Database: network_2
Question: How old is the youngest person for each job?
SQL: SELECT min(age) ,  job FROM Person GROUP BY job
Database: network_2
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Question: Find the person who has exactly one friend.
SQL: SELECT name FROM PersonFriend GROUP BY name HAVING count(*)  =  1
Database: network_2
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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')
Database: network_2
Question: What are the names, ages, and jobs of all people who are friends with Alice for the longest amount of time?
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')
Database: network_2
Question: Who is the person that has no friend?
SQL: SELECT name FROM person EXCEPT SELECT name FROM PersonFriend
Database: network_2
Question: What are the names of all people who do not have friends?
SQL: SELECT name FROM person EXCEPT SELECT name FROM PersonFriend
Database: network_2
Question: Which person whose friends have the oldest average age?
SQL: 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
Database: network_2
Question: What is the name of the person who has the oldest average age for their friends, and what is that average age?
SQL: 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
Database: network_2
Question: What is the total number of people who has no friend living in the city of Austin.
SQL: SELECT count(DISTINCT name) FROM PersonFriend WHERE friend NOT IN (SELECT name FROM person WHERE city  =  'Austin')
Database: network_2
Question: What is the total number of people who have no friends living in Austin?
SQL: SELECT count(DISTINCT name) FROM PersonFriend WHERE friend NOT IN (SELECT name FROM person WHERE city  =  'Austin')
Database: network_2
Question: Find Alice's friends of friends.
SQL: 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'
Database: network_2
Question: What are the names of all of Alice's friends of friends?
SQL: 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'
Database: decoration_competition
Question: How many members are there?
SQL: SELECT count(*) FROM member
Database: decoration_competition
Question: List the names of members in ascending alphabetical order.
SQL: SELECT Name FROM member ORDER BY Name ASC
Database: decoration_competition
Question: What are the names and countries of members?
SQL: SELECT Name ,  Country FROM member
Database: decoration_competition
Question: Show the names of members whose country is "United States" or "Canada".
SQL: SELECT Name FROM member WHERE Country  =  "United States" OR Country  =  "Canada"
Database: decoration_competition
Question: Show the different countries and the number of members from each.
SQL: SELECT Country ,  COUNT(*) FROM member GROUP BY Country
Database: decoration_competition
Question: Show the most common country across members.
SQL: SELECT Country FROM member GROUP BY Country ORDER BY COUNT(*) DESC LIMIT 1
Database: decoration_competition
Question: Which countries have more than two members?
SQL: SELECT Country FROM member GROUP BY Country HAVING COUNT(*)  >  2
Database: decoration_competition
Question: Show the leader names and locations of colleges.
SQL: SELECT Leader_Name ,  College_Location FROM college
Database: decoration_competition
Question: Show the names of members and names of colleges they go to.
SQL: SELECT T2.Name ,  T1.Name FROM college AS T1 JOIN member AS T2 ON T1.College_ID  =  T2.College_ID
Database: decoration_competition
Question: Show the names of members and the locations of colleges they go to in ascending alphabetical order of member names.
SQL: 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
Database: decoration_competition
Question: Show the distinct leader names of colleges associated with members from country "Canada".
SQL: SELECT DISTINCT T1.Leader_Name FROM college AS T1 JOIN member AS T2 ON T1.College_ID  =  T2.College_ID WHERE T2.Country  =  "Canada"
Database: decoration_competition
Question: Show the names of members and the decoration themes they have.
SQL: SELECT T1.Name ,  T2.Decoration_Theme FROM member AS T1 JOIN round AS T2 ON T1.Member_ID  =  T2.Member_ID
Database: decoration_competition
Question: Show the names of members that have a rank in round higher than 3.
SQL: SELECT T1.Name FROM member AS T1 JOIN round AS T2 ON T1.Member_ID  =  T2.Member_ID WHERE T2.Rank_in_Round  >  3
Database: decoration_competition
Question: Show the names of members in ascending order of their rank in rounds.
SQL: SELECT T1.Name FROM member AS T1 JOIN round AS T2 ON T1.Member_ID  =  T2.Member_ID ORDER BY Rank_in_Round ASC
Database: decoration_competition
Question: List the names of members who did not participate in any round.
SQL: SELECT Name FROM member WHERE Member_ID NOT IN (SELECT Member_ID FROM round)
Database: document_management
Question: Find the name and access counts of all documents, in alphabetic order of the document name.
SQL: SELECT document_name ,  access_count FROM documents ORDER BY document_name
Database: document_management
Question: What are the names of all the documents, as well as the access counts of each, ordered alphabetically?
SQL: SELECT document_name ,  access_count FROM documents ORDER BY document_name
Database: document_management
Question: Find the name of the document that has been accessed the greatest number of times, as well as the count of how many times it has been accessed?
SQL: SELECT document_name ,  access_count FROM documents ORDER BY access_count DESC LIMIT 1
Database: document_management
Question: What is the name of the document which has been accessed the most times, as well as the number of times it has been accessed?
SQL: SELECT document_name ,  access_count FROM documents ORDER BY access_count DESC LIMIT 1
Database: document_management
Question: Find the types of documents with more than 4 documents.
SQL: SELECT document_type_code FROM documents GROUP BY document_type_code HAVING count(*)  >  4
Database: document_management
Question: What are the codes of types of documents of which there are for or more?
SQL: SELECT document_type_code FROM documents GROUP BY document_type_code HAVING count(*)  >  4
Database: document_management
Question: Find the total access count of all documents in the most popular document type.
SQL: SELECT sum(access_count) FROM documents GROUP BY document_type_code ORDER BY count(*) DESC LIMIT 1
Database: document_management
Question: What is the total access count of documents that are of the most common document type?
SQL: SELECT sum(access_count) FROM documents GROUP BY document_type_code ORDER BY count(*) DESC LIMIT 1
Database: document_management
Question: What is the average access count of documents?
SQL: SELECT avg(access_count) FROM documents
Database: document_management
Question: Find the average access count across all documents?
SQL: SELECT avg(access_count) FROM documents
Database: document_management
Question: What is the structure of the document with the least number of accesses?
SQL: SELECT t2.document_structure_description FROM documents AS t1 JOIN document_structures AS t2 ON t1.document_structure_code  =  t2.document_structure_code GROUP BY t1.document_structure_code ORDER BY count(*) DESC LIMIT 1
Database: document_management
Question: Return the structure description of the document that has been accessed the fewest number of times.
SQL: SELECT t2.document_structure_description FROM documents AS t1 JOIN document_structures AS t2 ON t1.document_structure_code  =  t2.document_structure_code GROUP BY t1.document_structure_code ORDER BY count(*) DESC LIMIT 1
Database: document_management
Question: What is the type of the document named "David CV"?
SQL: SELECT document_type_code FROM documents WHERE document_name  =  "David CV"
Database: document_management
Question: Return the type code of the document named "David CV".
SQL: SELECT document_type_code FROM documents WHERE document_name  =  "David CV"
Database: document_management
Question: Find the list of documents that are both in the most three popular type and have the most three popular structure.
SQL: SELECT document_name FROM documents GROUP BY document_type_code ORDER BY count(*) DESC LIMIT 3 INTERSECT SELECT document_name FROM documents GROUP BY document_structure_code ORDER BY count(*) DESC LIMIT 3
Database: document_management
Question: What are the names of documents that have both one of the three most common types and one of three most common structures?
SQL: SELECT document_name FROM documents GROUP BY document_type_code ORDER BY count(*) DESC LIMIT 3 INTERSECT SELECT document_name FROM documents GROUP BY document_structure_code ORDER BY count(*) DESC LIMIT 3
Database: document_management
Question: What document types do have more than 10000 total access number.
SQL: SELECT document_type_code FROM documents GROUP BY document_type_code HAVING sum(access_count)  >  10000
Database: document_management
Question: Return the codes of the document types that do not have a total access count of over 10000.
SQL: SELECT document_type_code FROM documents GROUP BY document_type_code HAVING sum(access_count)  >  10000
Database: document_management
Question: What are all the section titles of the document named "David CV"?
SQL: SELECT t2.section_title FROM documents AS t1 JOIN document_sections AS t2 ON t1.document_code  =  t2.document_code WHERE t1.document_name  =  "David CV"
Database: document_management
Question: Give the section titles of the document with the name "David CV".
SQL: SELECT t2.section_title FROM documents AS t1 JOIN document_sections AS t2 ON t1.document_code  =  t2.document_code WHERE t1.document_name  =  "David CV"
Database: document_management
Question: Find all the name of documents without any sections.
SQL: SELECT document_name FROM documents WHERE document_code NOT IN (SELECT document_code FROM document_sections)
Database: document_management
Question: What are the names of documents that do not have any sections?
SQL: SELECT document_name FROM documents WHERE document_code NOT IN (SELECT document_code FROM document_sections)
Database: document_management
Question: List all the username and passwords of users with the most popular role.
SQL: SELECT user_name ,  password FROM users GROUP BY role_code ORDER BY count(*) DESC LIMIT 1
Database: document_management
Question: What are the usernames and passwords of users that have the most common role?
SQL: SELECT user_name ,  password FROM users GROUP BY role_code ORDER BY count(*) DESC LIMIT 1
Database: document_management
Question: Find the average access counts of documents with functional area "Acknowledgement".
SQL: SELECT avg(t1.access_count) FROM documents AS t1 JOIN document_functional_areas AS t2 ON t1.document_code  =  t2.document_code JOIN functional_areas AS t3 ON t2.functional_area_code  =  t3.functional_area_code WHERE t3.functional_area_description  =  "Acknowledgement"
Database: document_management
Question: What are the average access counts of documents that have the functional area description "Acknowledgement"?
SQL: SELECT avg(t1.access_count) FROM documents AS t1 JOIN document_functional_areas AS t2 ON t1.document_code  =  t2.document_code JOIN functional_areas AS t3 ON t2.functional_area_code  =  t3.functional_area_code WHERE t3.functional_area_description  =  "Acknowledgement"
Database: document_management
Question: Find names of the document without any images.
SQL: SELECT document_name FROM documents EXCEPT SELECT t1.document_name FROM documents AS t1 JOIN document_sections AS t2 ON t1.document_code  =  t2.document_code JOIN document_sections_images AS t3 ON t2.section_id  =  t3.section_id
Database: document_management
Question: What are the names of documents that do not have any images?
SQL: SELECT document_name FROM documents EXCEPT SELECT t1.document_name FROM documents AS t1 JOIN document_sections AS t2 ON t1.document_code  =  t2.document_code JOIN document_sections_images AS t3 ON t2.section_id  =  t3.section_id
Database: document_management
Question: What is the name of the document with the most number of sections?
SQL: SELECT t1.document_name FROM documents AS t1 JOIN document_sections AS t2 ON t1.document_code  =  t2.document_code GROUP BY t1.document_code ORDER BY count(*) DESC LIMIT 1
Database: document_management
Question: Return the name of the document that has the most sections.
SQL: SELECT t1.document_name FROM documents AS t1 JOIN document_sections AS t2 ON t1.document_code  =  t2.document_code GROUP BY t1.document_code ORDER BY count(*) DESC LIMIT 1
Database: document_management
Question: List all the document names which contains "CV".
SQL: SELECT document_name FROM documents WHERE document_name LIKE "%CV%"
Database: document_management
Question: What are the names of documents that contain the substring "CV"?
SQL: SELECT document_name FROM documents WHERE document_name LIKE "%CV%"
Database: document_management
Question: How many users are logged in?
SQL: SELECT count(*) FROM users WHERE user_login  =  1
Database: document_management
Question: Count the number of users that are logged in.
SQL: SELECT count(*) FROM users WHERE user_login  =  1
Database: document_management
Question: Find the description of the most popular role among the users that have logged in.
SQL: SELECT role_description FROM ROLES WHERE role_code  =  (SELECT role_code FROM users WHERE user_login  =  1 GROUP BY role_code ORDER BY count(*) DESC LIMIT 1)
Database: document_management
Question: What is the description of the most popular role among users that have logged in?
SQL: SELECT role_description FROM ROLES WHERE role_code  =  (SELECT role_code FROM users WHERE user_login  =  1 GROUP BY role_code ORDER BY count(*) DESC LIMIT 1)
Database: document_management
Question: Find the average access count of documents with the least popular structure.
SQL: SELECT avg(access_count) FROM documents GROUP BY document_structure_code ORDER BY count(*) ASC LIMIT 1
Database: document_management
Question: What is the average access count of documents that have the least common structure?
SQL: SELECT avg(access_count) FROM documents GROUP BY document_structure_code ORDER BY count(*) ASC LIMIT 1
Database: document_management
Question: List all the image name and URLs in the order of their names.
SQL: SELECT image_name ,  image_url FROM images ORDER BY image_name
Database: document_management
Question: What are the names and urls of images, sorted alphabetically?
SQL: SELECT image_name ,  image_url FROM images ORDER BY image_name
Database: document_management
Question: Find the number of users in each role.
SQL: SELECT count(*) ,  role_code FROM users GROUP BY role_code
Database: document_management
Question: What are the different role codes for users, and how many users have each?
SQL: SELECT count(*) ,  role_code FROM users GROUP BY role_code
Database: document_management
Question: What document types have more than 2 corresponding documents?
SQL: SELECT document_type_code FROM documents GROUP BY document_type_code HAVING count(*)  >  2
Database: document_management
Question: Give the codes of document types that have more than 2 corresponding documents.
SQL: SELECT document_type_code FROM documents GROUP BY document_type_code HAVING count(*)  >  2
Database: company_office
Question: How many companies are there?
SQL: SELECT count(*) FROM Companies
Database: company_office
Question: Count the number of companies.
SQL: SELECT count(*) FROM Companies
Database: company_office
Question: List the names of companies in descending order of market value.
SQL: SELECT name FROM Companies ORDER BY Market_Value_billion DESC
Database: company_office
Question: Sort the company names in descending order of the company's market value.
SQL: SELECT name FROM Companies ORDER BY Market_Value_billion DESC
Database: company_office
Question: What are the names of companies whose headquarters are not "USA"?
SQL: SELECT name FROM Companies WHERE Headquarters != 'USA'
Database: company_office
Question: Find the names of the companies whose headquarters are not located in "USA".
SQL: SELECT name FROM Companies WHERE Headquarters != 'USA'
Database: company_office
Question: What are the name and assets of each company, sorted in ascending order of company name?
SQL: SELECT name ,  Assets_billion FROM Companies ORDER BY name ASC
Database: company_office
Question: List the name and assets of each company in ascending order of company name.
SQL: SELECT name ,  Assets_billion FROM Companies ORDER BY name ASC
Database: company_office
Question: What are the average profits of companies?
SQL: SELECT avg(Profits_billion) FROM Companies
Database: company_office
Question: Compute the average profits companies make.
SQL: SELECT avg(Profits_billion) FROM Companies
Database: company_office
Question: What are the maximum and minimum sales of the companies whose industries are not "Banking".
SQL: SELECT max(Sales_billion) ,  min(Sales_billion) FROM Companies WHERE Industry != "Banking"
Database: company_office
Question: Find the maximum and minimum sales of the companies that are not in the "Banking" industry.
SQL: SELECT max(Sales_billion) ,  min(Sales_billion) FROM Companies WHERE Industry != "Banking"
Database: company_office
Question: How many different industries are the companies in?
SQL: SELECT count(DISTINCT Industry) FROM Companies