Unnamed: 0
int64
0
60k
input
stringlengths
76
562
answer
stringlengths
18
557
2,500
<question>: Find out the send dates of the documents with the grant amount of more than 5000 were granted by organisation type described <context>: CREATE TABLE organisation_Types (organisation_type VARCHAR, organisation_type_description VARCHAR); CREATE TABLE Grants (grant_id VARCHAR, organisation_id VARCHAR, grant_amount VARCHAR); CREATE TABLE Organisations (organisation_id VARCHAR, organisation_type VARCHAR); CREATE TABLE documents (sent_date VARCHAR, grant_id VARCHAR)
SELECT T1.sent_date FROM documents AS T1 JOIN Grants AS T2 ON T1.grant_id = T2.grant_id JOIN Organisations AS T3 ON T2.organisation_id = T3.organisation_id JOIN organisation_Types AS T4 ON T3.organisation_type = T4.organisation_type WHERE T2.grant_amount > 5000 AND T4.organisation_type_description = 'Research'
2,501
<question>: What are the response received dates for the documents described as 'Regular' or granted with more than 100? <context>: CREATE TABLE Documents (response_received_date VARCHAR, document_type_code VARCHAR, grant_id VARCHAR); CREATE TABLE Document_Types (document_type_code VARCHAR, document_description VARCHAR); CREATE TABLE Grants (grant_id VARCHAR, grant_amount VARCHAR)
SELECT T1.response_received_date FROM Documents AS T1 JOIN Document_Types AS T2 ON T1.document_type_code = T2.document_type_code JOIN Grants AS T3 ON T1.grant_id = T3.grant_id WHERE T2.document_description = 'Regular' OR T3.grant_amount > 100
2,502
<question>: List the project details of the projects which did not hire any staff for a researcher role. <context>: CREATE TABLE Projects (project_details VARCHAR, project_id VARCHAR, role_code VARCHAR); CREATE TABLE Project_Staff (project_details VARCHAR, project_id VARCHAR, role_code VARCHAR)
SELECT project_details FROM Projects WHERE NOT project_id IN (SELECT project_id FROM Project_Staff WHERE role_code = 'researcher')
2,503
<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? <context>: CREATE TABLE Projects (project_id VARCHAR, project_details VARCHAR); CREATE TABLE Project_outcomes (project_id VARCHAR); CREATE TABLE Tasks (task_details VARCHAR, task_id VARCHAR, project_id VARCHAR)
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
2,504
<question>: When do all the researcher role staff start to work, and when do they stop working? <context>: CREATE TABLE Project_Staff (date_from VARCHAR, date_to VARCHAR, role_code VARCHAR)
SELECT date_from, date_to FROM Project_Staff WHERE role_code = 'researcher'
2,505
<question>: How many kinds of roles are there for the staff? <context>: CREATE TABLE Project_Staff (role_code VARCHAR)
SELECT COUNT(DISTINCT role_code) FROM Project_Staff
2,506
<question>: What is the total amount of grants given by each organisations? Also list the organisation id. <context>: CREATE TABLE Grants (organisation_id VARCHAR, grant_amount INTEGER)
SELECT SUM(grant_amount), organisation_id FROM Grants GROUP BY organisation_id
2,507
<question>: List the project details of the projects with the research outcome described with the substring 'Published'. <context>: CREATE TABLE Research_outcomes (outcome_code VARCHAR, outcome_description VARCHAR); CREATE TABLE Project_outcomes (project_id VARCHAR, outcome_code VARCHAR); CREATE TABLE Projects (project_details VARCHAR, project_id VARCHAR)
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%'
2,508
<question>: How many staff does each project has? List the project id and the number in an ascending order. <context>: CREATE TABLE Project_Staff (project_id VARCHAR); CREATE TABLE Projects (project_id VARCHAR)
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(*)
2,509
<question>: What is the complete description of the researcher role. <context>: CREATE TABLE Staff_Roles (role_description VARCHAR, role_code VARCHAR)
SELECT role_description FROM Staff_Roles WHERE role_code = 'researcher'
2,510
<question>: When did the first staff for the projects started working? <context>: CREATE TABLE Project_Staff (date_from VARCHAR)
SELECT date_from FROM Project_Staff ORDER BY date_from LIMIT 1
2,511
<question>: Which project made the most number of outcomes? List the project details and the project id. <context>: CREATE TABLE Project_outcomes (project_id VARCHAR); CREATE TABLE Projects (project_details VARCHAR, project_id VARCHAR)
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
2,512
<question>: Which projects have no outcome? List the project details. <context>: CREATE TABLE Project_outcomes (project_details VARCHAR, project_id VARCHAR); CREATE TABLE Projects (project_details VARCHAR, project_id VARCHAR)
SELECT project_details FROM Projects WHERE NOT project_id IN (SELECT project_id FROM Project_outcomes)
2,513
<question>: Which organisation hired the most number of research staff? List the organisation id, type and detail. <context>: CREATE TABLE Organisations (organisation_id VARCHAR, organisation_type VARCHAR, organisation_details VARCHAR); CREATE TABLE Research_Staff (employer_organisation_id VARCHAR)
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
2,514
<question>: Show the role description and the id of the project staff involved in most number of project outcomes? <context>: CREATE TABLE Project_outcomes (project_id VARCHAR); CREATE TABLE Project_Staff (staff_id VARCHAR, role_code VARCHAR, project_id VARCHAR); CREATE TABLE Staff_Roles (role_description VARCHAR, role_code VARCHAR)
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
2,515
<question>: Which document type is described with the prefix 'Initial'? <context>: CREATE TABLE Document_Types (document_type_code VARCHAR, document_description VARCHAR)
SELECT document_type_code FROM Document_Types WHERE document_description LIKE 'Initial%'
2,516
<question>: For grants with both documents described as 'Regular' and documents described as 'Initial Application', list its start date. <context>: CREATE TABLE Grants (grant_start_date VARCHAR, grant_id VARCHAR); CREATE TABLE Document_Types (document_type_code VARCHAR, document_description VARCHAR); CREATE TABLE Documents (grant_id VARCHAR, document_type_code VARCHAR)
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'
2,517
<question>: How many documents can one grant have at most? List the grant id and number. <context>: CREATE TABLE Documents (grant_id VARCHAR)
SELECT grant_id, COUNT(*) FROM Documents GROUP BY grant_id ORDER BY COUNT(*) DESC LIMIT 1
2,518
<question>: Find the organisation type description of the organisation detailed as 'quo'. <context>: CREATE TABLE Organisations (organisation_type VARCHAR, organisation_details VARCHAR); CREATE TABLE organisation_Types (organisation_type_description VARCHAR, organisation_type VARCHAR)
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'
2,519
<question>: What are all the details of the organisations described as 'Sponsor'? Sort the result in an ascending order. <context>: CREATE TABLE organisation_Types (organisation_type VARCHAR, organisation_type_description VARCHAR); CREATE TABLE Organisations (organisation_type VARCHAR)
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
2,520
<question>: How many Patent outcomes are generated from all the projects? <context>: CREATE TABLE Project_outcomes (outcome_code VARCHAR)
SELECT COUNT(*) FROM Project_outcomes WHERE outcome_code = 'Patent'
2,521
<question>: How many project staff worked as leaders or started working before '1989-04-24 23:51:54'? <context>: CREATE TABLE Project_Staff (role_code VARCHAR, date_from VARCHAR)
SELECT COUNT(*) FROM Project_Staff WHERE role_code = 'leader' OR date_from < '1989-04-24 23:51:54'
2,522
<question>: What is the last date of the staff leaving the projects? <context>: CREATE TABLE Project_Staff (date_to VARCHAR)
SELECT date_to FROM Project_Staff ORDER BY date_to DESC LIMIT 1
2,523
<question>: What are the result description of the project whose detail is 'sint'? <context>: CREATE TABLE Project_outcomes (outcome_code VARCHAR, project_id VARCHAR); CREATE TABLE Research_outcomes (outcome_description VARCHAR, outcome_code VARCHAR); CREATE TABLE Projects (project_id VARCHAR, project_details VARCHAR)
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'
2,524
<question>: List the organisation id with the maximum outcome count, and the count. <context>: CREATE TABLE Project_outcomes (project_id VARCHAR); CREATE TABLE Projects (organisation_id VARCHAR, project_id VARCHAR)
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
2,525
<question>: List the project details of the projects launched by the organisation <context>: CREATE TABLE Projects (project_details VARCHAR, organisation_id VARCHAR)
SELECT project_details FROM Projects WHERE organisation_id IN (SELECT organisation_id FROM Projects GROUP BY organisation_id ORDER BY COUNT(*) DESC LIMIT 1)
2,526
<question>: List the research staff details, and order in ascending order. <context>: CREATE TABLE Research_Staff (staff_details VARCHAR)
SELECT staff_details FROM Research_Staff ORDER BY staff_details
2,527
<question>: How many tasks are there in total? <context>: CREATE TABLE Tasks (Id VARCHAR)
SELECT COUNT(*) FROM Tasks
2,528
<question>: How many tasks does each project have? List the task count and the project detail. <context>: CREATE TABLE Projects (project_details VARCHAR, project_id VARCHAR); CREATE TABLE Tasks (project_id VARCHAR)
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
2,529
<question>: What are the staff roles of the staff who <context>: CREATE TABLE Project_Staff (role_code VARCHAR, date_from VARCHAR, date_to VARCHAR)
SELECT role_code FROM Project_Staff WHERE date_from > '2003-04-19 15:06:20' AND date_to < '2016-03-15 00:33:18'
2,530
<question>: What are the descriptions of all the project outcomes? <context>: CREATE TABLE Research_outcomes (outcome_description VARCHAR, outcome_code VARCHAR); CREATE TABLE Project_outcomes (outcome_code VARCHAR)
SELECT T1.outcome_description FROM Research_outcomes AS T1 JOIN Project_outcomes AS T2 ON T1.outcome_code = T2.outcome_code
2,531
<question>: Which role is most common for the staff? <context>: CREATE TABLE Project_Staff (role_code VARCHAR)
SELECT role_code FROM Project_Staff GROUP BY role_code ORDER BY COUNT(*) DESC LIMIT 1
2,532
<question>: How many friends does Dan have? <context>: CREATE TABLE PersonFriend (friend VARCHAR, name VARCHAR); CREATE TABLE Person (name VARCHAR)
SELECT COUNT(T2.friend) FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T1.name = 'Dan'
2,533
<question>: How many females does this network has? <context>: CREATE TABLE Person (gender VARCHAR)
SELECT COUNT(*) FROM Person WHERE gender = 'female'
2,534
<question>: What is the average age for all person? <context>: CREATE TABLE Person (age INTEGER)
SELECT AVG(age) FROM Person
2,535
<question>: How many different cities are they from? <context>: CREATE TABLE Person (city VARCHAR)
SELECT COUNT(DISTINCT city) FROM Person
2,536
<question>: How many type of jobs do they have? <context>: CREATE TABLE Person (job VARCHAR)
SELECT COUNT(DISTINCT job) FROM Person
2,537
<question>: Who is the oldest person? <context>: CREATE TABLE Person (name VARCHAR, age INTEGER); CREATE TABLE person (name VARCHAR, age INTEGER)
SELECT name FROM Person WHERE age = (SELECT MAX(age) FROM person)
2,538
<question>: Who is the oldest person whose job is student? <context>: CREATE TABLE person (name VARCHAR, job VARCHAR, age INTEGER); CREATE TABLE Person (name VARCHAR, job VARCHAR, age INTEGER)
SELECT name FROM Person WHERE job = 'student' AND age = (SELECT MAX(age) FROM person WHERE job = 'student')
2,539
<question>: Who is the youngest male? <context>: CREATE TABLE Person (name VARCHAR, gender VARCHAR, age INTEGER); CREATE TABLE person (name VARCHAR, gender VARCHAR, age INTEGER)
SELECT name FROM Person WHERE gender = 'male' AND age = (SELECT MIN(age) FROM person WHERE gender = 'male')
2,540
<question>: How old is the doctor named Zach? <context>: CREATE TABLE Person (age VARCHAR, job VARCHAR, name VARCHAR)
SELECT age FROM Person WHERE job = 'doctor' AND name = 'Zach'
2,541
<question>: Who is the person whose age is below 30? <context>: CREATE TABLE Person (name VARCHAR, age INTEGER)
SELECT name FROM Person WHERE age < 30
2,542
<question>: How many people whose age is greater 30 and job is engineer? <context>: CREATE TABLE Person (age VARCHAR, job VARCHAR)
SELECT COUNT(*) FROM Person WHERE age > 30 AND job = 'engineer'
2,543
<question>: What is the average age for each gender? <context>: CREATE TABLE Person (gender VARCHAR, age INTEGER)
SELECT AVG(age), gender FROM Person GROUP BY gender
2,544
<question>: What is average age for different job title? <context>: CREATE TABLE Person (job VARCHAR, age INTEGER)
SELECT AVG(age), job FROM Person GROUP BY job
2,545
<question>: What is average age of male for different job title? <context>: CREATE TABLE Person (job VARCHAR, age INTEGER, gender VARCHAR)
SELECT AVG(age), job FROM Person WHERE gender = 'male' GROUP BY job
2,546
<question>: What is minimum age for different job title? <context>: CREATE TABLE Person (job VARCHAR, age INTEGER)
SELECT MIN(age), job FROM Person GROUP BY job
2,547
<question>: Find the number of people who is under 40 for each gender. <context>: CREATE TABLE Person (gender VARCHAR, age INTEGER)
SELECT COUNT(*), gender FROM Person WHERE age < 40 GROUP BY gender
2,548
<question>: Find the name of people whose age is greater than any engineer sorted by their age. <context>: CREATE TABLE Person (name VARCHAR, age INTEGER, job VARCHAR); CREATE TABLE person (name VARCHAR, age INTEGER, job VARCHAR)
SELECT name FROM Person WHERE age > (SELECT MIN(age) FROM person WHERE job = 'engineer') ORDER BY age
2,549
<question>: Find the number of people whose age is greater than all engineers. <context>: CREATE TABLE Person (age INTEGER, job VARCHAR); CREATE TABLE person (age INTEGER, job VARCHAR)
SELECT COUNT(*) FROM Person WHERE age > (SELECT MAX(age) FROM person WHERE job = 'engineer')
2,550
<question>: list the name, job title of all people ordered by their names. <context>: CREATE TABLE Person (name VARCHAR, job VARCHAR)
SELECT name, job FROM Person ORDER BY name
2,551
<question>: Find the names of all person sorted in the descending order using age. <context>: CREATE TABLE Person (name VARCHAR, age VARCHAR)
SELECT name FROM Person ORDER BY age DESC
2,552
<question>: Find the name and age of all males in order of their age. <context>: CREATE TABLE Person (name VARCHAR, gender VARCHAR, age VARCHAR)
SELECT name FROM Person WHERE gender = 'male' ORDER BY age
2,553
<question>: Find the name and age of the person who is a friend of both Dan and Alice. <context>: CREATE TABLE Person (name VARCHAR, age VARCHAR); CREATE TABLE PersonFriend (name VARCHAR, friend VARCHAR)
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'
2,554
<question>: Find the name and age of the person who is a friend of Dan or Alice. <context>: CREATE TABLE Person (name VARCHAR, age VARCHAR); CREATE TABLE PersonFriend (name VARCHAR, friend VARCHAR)
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'
2,555
<question>: Find the name of the person who has friends with age above 40 and under age 30? <context>: CREATE TABLE Person (name VARCHAR, age INTEGER); CREATE TABLE PersonFriend (name VARCHAR, friend VARCHAR); CREATE TABLE Person (name VARCHAR)
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)
2,556
<question>: Find the name of the person who has friends with age above 40 but not under age 30? <context>: CREATE TABLE Person (name VARCHAR, age INTEGER); CREATE TABLE PersonFriend (name VARCHAR, friend VARCHAR); CREATE TABLE Person (name VARCHAR)
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)
2,557
<question>: Find the name of the person who has no student friends. <context>: CREATE TABLE Person (name VARCHAR, job VARCHAR); CREATE TABLE PersonFriend (name VARCHAR, friend VARCHAR); CREATE TABLE person (name VARCHAR)
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'
2,558
<question>: Find the person who has exactly one friend. <context>: CREATE TABLE PersonFriend (name VARCHAR)
SELECT name FROM PersonFriend GROUP BY name HAVING COUNT(*) = 1
2,559
<question>: Who are the friends of Bob? <context>: CREATE TABLE PersonFriend (friend VARCHAR, name VARCHAR); CREATE TABLE Person (name VARCHAR)
SELECT T2.friend FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T1.name = 'Bob'
2,560
<question>: Find the name of persons who are friends with Bob. <context>: CREATE TABLE PersonFriend (name VARCHAR, friend VARCHAR); CREATE TABLE Person (name VARCHAR)
SELECT T1.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend = 'Bob'
2,561
<question>: Find the names of females who are friends with Zach <context>: CREATE TABLE PersonFriend (name VARCHAR, friend VARCHAR); CREATE TABLE Person (name VARCHAR, gender VARCHAR)
SELECT T1.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend = 'Zach' AND T1.gender = 'female'
2,562
<question>: Find the female friends of Alice. <context>: CREATE TABLE PersonFriend (friend VARCHAR, name VARCHAR); CREATE TABLE Person (name VARCHAR, gender VARCHAR)
SELECT T2.friend FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T2.name = 'Alice' AND T1.gender = 'female'
2,563
<question>: Find the male friend of Alice whose job is a doctor? <context>: CREATE TABLE PersonFriend (friend VARCHAR, name VARCHAR); CREATE TABLE Person (name VARCHAR, job VARCHAR, gender VARCHAR)
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'
2,564
<question>: Who has a friend that is from new york city? <context>: CREATE TABLE Person (name VARCHAR, city VARCHAR); CREATE TABLE PersonFriend (name VARCHAR, friend VARCHAR)
SELECT T2.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T1.city = 'new york city'
2,565
<question>: Who has friends that are younger than the average age? <context>: CREATE TABLE person (age INTEGER); CREATE TABLE Person (name VARCHAR, age INTEGER); CREATE TABLE PersonFriend (name VARCHAR, friend VARCHAR)
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)
2,566
<question>: Who has friends that are older than the average age? Print their friends and their ages as well <context>: CREATE TABLE person (age INTEGER); CREATE TABLE PersonFriend (name VARCHAR, friend VARCHAR); CREATE TABLE Person (age INTEGER, name VARCHAR)
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)
2,567
<question>: Who is the friend of Zach with longest year relationship? <context>: CREATE TABLE PersonFriend (friend VARCHAR, name VARCHAR, YEAR INTEGER)
SELECT friend FROM PersonFriend WHERE name = 'Zach' AND YEAR = (SELECT MAX(YEAR) FROM PersonFriend WHERE name = 'Zach')
2,568
<question>: What is the age of the friend of Zach with longest year relationship? <context>: CREATE TABLE PersonFriend (friend VARCHAR, name VARCHAR, year VARCHAR); CREATE TABLE PersonFriend (YEAR INTEGER, name VARCHAR); CREATE TABLE Person (age VARCHAR, name VARCHAR)
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')
2,569
<question>: Find the name of persons who are friends with Alice for the shortest years. <context>: CREATE TABLE PersonFriend (name VARCHAR, friend VARCHAR, YEAR INTEGER)
SELECT name FROM PersonFriend WHERE friend = 'Alice' AND YEAR = (SELECT MIN(YEAR) FROM PersonFriend WHERE friend = 'Alice')
2,570
<question>: Find the name, age, and job title of persons who are friends with Alice for the longest years. <context>: CREATE TABLE PersonFriend (name VARCHAR, friend VARCHAR, year VARCHAR); CREATE TABLE Person (name VARCHAR, age VARCHAR, job VARCHAR); CREATE TABLE PersonFriend (YEAR INTEGER, friend VARCHAR)
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')
2,571
<question>: Who is the person that has no friend? <context>: CREATE TABLE PersonFriend (name VARCHAR); CREATE TABLE person (name VARCHAR)
SELECT name FROM person EXCEPT SELECT name FROM PersonFriend
2,572
<question>: Which person whose friends have the oldest average age? <context>: CREATE TABLE PersonFriend (name VARCHAR, friend VARCHAR); CREATE TABLE Person (age INTEGER, name VARCHAR)
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
2,573
<question>: What is the total number of people who has no friend living in the city of Austin. <context>: CREATE TABLE person (name VARCHAR, friend VARCHAR, city VARCHAR); CREATE TABLE PersonFriend (name VARCHAR, friend VARCHAR, city VARCHAR)
SELECT COUNT(DISTINCT name) FROM PersonFriend WHERE NOT friend IN (SELECT name FROM person WHERE city = 'Austin')
2,574
<question>: Find Alice's friends of friends. <context>: CREATE TABLE PersonFriend (name VARCHAR); CREATE TABLE PersonFriend (name VARCHAR, friend VARCHAR); CREATE TABLE Person (name VARCHAR)
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'
2,575
<question>: How many members are there? <context>: CREATE TABLE member (Id VARCHAR)
SELECT COUNT(*) FROM member
2,576
<question>: List the names of members in ascending alphabetical order. <context>: CREATE TABLE member (Name VARCHAR)
SELECT Name FROM member ORDER BY Name
2,577
<question>: What are the names and countries of members? <context>: CREATE TABLE member (Name VARCHAR, Country VARCHAR)
SELECT Name, Country FROM member
2,578
<question>: Show the names of members whose country is "United States" or "Canada". <context>: CREATE TABLE member (Name VARCHAR, Country VARCHAR)
SELECT Name FROM member WHERE Country = "United States" OR Country = "Canada"
2,579
<question>: Show the different countries and the number of members from each. <context>: CREATE TABLE member (Country VARCHAR)
SELECT Country, COUNT(*) FROM member GROUP BY Country
2,580
<question>: Show the most common country across members. <context>: CREATE TABLE member (Country VARCHAR)
SELECT Country FROM member GROUP BY Country ORDER BY COUNT(*) DESC LIMIT 1
2,581
<question>: Which countries have more than two members? <context>: CREATE TABLE member (Country VARCHAR)
SELECT Country FROM member GROUP BY Country HAVING COUNT(*) > 2
2,582
<question>: Show the leader names and locations of colleges. <context>: CREATE TABLE college (Leader_Name VARCHAR, College_Location VARCHAR)
SELECT Leader_Name, College_Location FROM college
2,583
<question>: Show the names of members and names of colleges they go to. <context>: CREATE TABLE member (Name VARCHAR, College_ID VARCHAR); CREATE TABLE college (Name VARCHAR, College_ID VARCHAR)
SELECT T2.Name, T1.Name FROM college AS T1 JOIN member AS T2 ON T1.College_ID = T2.College_ID
2,584
<question>: Show the names of members and the locations of colleges they go to in ascending alphabetical order of member names. <context>: CREATE TABLE member (Name VARCHAR, College_ID VARCHAR); CREATE TABLE college (College_Location VARCHAR, College_ID VARCHAR)
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
2,585
<question>: Show the distinct leader names of colleges associated with members from country "Canada". <context>: CREATE TABLE college (Leader_Name VARCHAR, College_ID VARCHAR); CREATE TABLE member (College_ID VARCHAR, Country VARCHAR)
SELECT DISTINCT T1.Leader_Name FROM college AS T1 JOIN member AS T2 ON T1.College_ID = T2.College_ID WHERE T2.Country = "Canada"
2,586
<question>: Show the names of members and the decoration themes they have. <context>: CREATE TABLE member (Name VARCHAR, Member_ID VARCHAR); CREATE TABLE round (Decoration_Theme VARCHAR, Member_ID VARCHAR)
SELECT T1.Name, T2.Decoration_Theme FROM member AS T1 JOIN round AS T2 ON T1.Member_ID = T2.Member_ID
2,587
<question>: Show the names of members that have a rank in round higher than 3. <context>: CREATE TABLE round (Member_ID VARCHAR, Rank_in_Round INTEGER); CREATE TABLE member (Name VARCHAR, Member_ID VARCHAR)
SELECT T1.Name FROM member AS T1 JOIN round AS T2 ON T1.Member_ID = T2.Member_ID WHERE T2.Rank_in_Round > 3
2,588
<question>: Show the names of members in ascending order of their rank in rounds. <context>: CREATE TABLE member (Name VARCHAR, Member_ID VARCHAR); CREATE TABLE round (Member_ID VARCHAR)
SELECT T1.Name FROM member AS T1 JOIN round AS T2 ON T1.Member_ID = T2.Member_ID ORDER BY Rank_in_Round
2,589
<question>: List the names of members who did not participate in any round. <context>: CREATE TABLE member (Name VARCHAR, Member_ID VARCHAR); CREATE TABLE round (Name VARCHAR, Member_ID VARCHAR)
SELECT Name FROM member WHERE NOT Member_ID IN (SELECT Member_ID FROM round)
2,590
<question>: Find the name and access counts of all documents, in alphabetic order of the document name. <context>: CREATE TABLE documents (document_name VARCHAR, access_count VARCHAR)
SELECT document_name, access_count FROM documents ORDER BY document_name
2,591
<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? <context>: CREATE TABLE documents (document_name VARCHAR, access_count VARCHAR)
SELECT document_name, access_count FROM documents ORDER BY access_count DESC LIMIT 1
2,592
<question>: Find the types of documents with more than 4 documents. <context>: CREATE TABLE documents (document_type_code VARCHAR)
SELECT document_type_code FROM documents GROUP BY document_type_code HAVING COUNT(*) > 4
2,593
<question>: Find the total access count of all documents in the most popular document type. <context>: CREATE TABLE documents (access_count INTEGER, document_type_code VARCHAR)
SELECT SUM(access_count) FROM documents GROUP BY document_type_code ORDER BY COUNT(*) DESC LIMIT 1
2,594
<question>: What is the average access count of documents? <context>: CREATE TABLE documents (access_count INTEGER)
SELECT AVG(access_count) FROM documents
2,595
<question>: What is the structure of the document with the least number of accesses? <context>: CREATE TABLE document_structures (document_structure_description VARCHAR, document_structure_code VARCHAR); CREATE TABLE documents (document_structure_code VARCHAR)
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
2,596
<question>: What is the type of the document named "David CV"? <context>: CREATE TABLE documents (document_type_code VARCHAR, document_name VARCHAR)
SELECT document_type_code FROM documents WHERE document_name = "David CV"
2,597
<question>: Find the list of documents that are both in the most three popular type and have the most three popular structure. <context>: CREATE TABLE documents (document_name VARCHAR, document_type_code VARCHAR, document_structure_code VARCHAR)
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
2,598
<question>: What document types do have more than 10000 total access number. <context>: CREATE TABLE documents (document_type_code VARCHAR, access_count INTEGER)
SELECT document_type_code FROM documents GROUP BY document_type_code HAVING SUM(access_count) > 10000
2,599
<question>: What are all the section titles of the document named "David CV"? <context>: CREATE TABLE documents (document_code VARCHAR, document_name VARCHAR); CREATE TABLE document_sections (section_title VARCHAR, document_code VARCHAR)
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"