database_id
stringlengths
4
31
query
stringlengths
22
577
question
stringlengths
19
224
tracking_grants_for_research
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;
Which project made the most number of outcomes? List the project details and the project id.
tracking_grants_for_research
SELECT project_details FROM Projects WHERE project_id NOT IN ( SELECT project_id FROM Project_outcomes );
Which projects have no outcome? List the project details.
tracking_grants_for_research
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;
Which organisation hired the most number of research staff? List the organisation id, type and detail.
tracking_grants_for_research
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;
Show the role description and the id of the project staff involved in most number of project outcomes?
tracking_grants_for_research
SELECT document_type_code FROM Document_Types WHERE document_description LIKE 'Initial%';
Which document type is described with the prefix 'Initial'?
tracking_grants_for_research
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.gran...
For grants with both documents described as 'Regular' and documents described as 'Initial Application', list its start date.
tracking_grants_for_research
SELECT grant_id , count(*) FROM Documents GROUP BY grant_id ORDER BY count(*) DESC LIMIT 1;
How many documents can one grant have at most? List the grant id and number.
tracking_grants_for_research
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';
Find the organisation type description of the organisation detailed as 'quo'.
tracking_grants_for_research
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 ASC;
What are all the details of the organisations described as 'Sponsor'? Sort the result in an ascending order.
tracking_grants_for_research
SELECT count(*) FROM Project_Staff WHERE role_code = 'leader' OR date_from < '1989-04-24 23:51:54';
How many project staff worked as leaders or started working before '1989-04-24 23:51:54'?
tracking_grants_for_research
SELECT date_to FROM Project_Staff ORDER BY date_to DESC LIMIT 1;
What is the last date of the staff leaving the projects?
tracking_grants_for_research
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';
What are the result description of the project whose detail is 'sint'?
tracking_grants_for_research
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;
List the organisation id with the maximum outcome count, and the count.
tracking_grants_for_research
SELECT project_details FROM Projects WHERE organisation_id IN ( SELECT organisation_id FROM Projects GROUP BY organisation_id ORDER BY count(*) DESC LIMIT 1 );
List the project details of the projects launched by the organisation with the most number of projects.
tracking_grants_for_research
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;
How many tasks does each project have? List the task count and the project detail.
tracking_grants_for_research
SELECT role_code FROM Project_Staff WHERE date_from > '2003-04-19 15:06:20' AND date_to < '2016-03-15 00:33:18'
What are the staff roles of the staff who starts working after 2003-04-19 15:06:20 and ends working before 2016-03-15 00:33:18?
icfp_1
SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t1.fname = "Jeremy" AND t1.lname = "Gibbons"
What are the titles of papers published by "Jeremy Gibbons"?
icfp_1
SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t1.fname = "Aaron" AND t1.lname = "Turon"
Find all the papers published by "Aaron Turon".
icfp_1
SELECT count(*) FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t1.fname = "Atsushi" AND t1.lname = "Ohori"
How many papers have "Atsushi Ohori" published?
icfp_1
SELECT DISTINCT t3.name FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t1.fname = "Matthias" AND t1.lname = "Blume"
What is the name of the institution that "Matthias Blume" belongs to?
icfp_1
SELECT DISTINCT t3.name FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t1.fname = "Katsuhiro" AND t1.lname = "Ueno"
Which institution does "Katsuhiro Ueno" belong to?
icfp_1
SELECT DISTINCT t1.fname , t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = "University of Oxford"
Who belong to the institution "University of Oxford"? Show the first names and last names.
icfp_1
SELECT DISTINCT t1.fname , t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = "Google"
Which authors belong to the institution "Google"? Show the first names and last names.
icfp_1
SELECT t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t3.title = "Binders Unbound"
What are the last names of the author of the paper titled "Binders Unbound"?
icfp_1
SELECT t1.fname , t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t3.title = "Nameless , Painless"
Find the first and last name of the author(s) who wrote the paper "Nameless, Painless".
icfp_1
SELECT DISTINCT t1.title FROM papers AS t1 JOIN authorship AS t2 ON t1.paperid = t2.paperid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = "Indiana University"
What are the papers published under the institution "Indiana University"?
icfp_1
SELECT DISTINCT t1.title FROM papers AS t1 JOIN authorship AS t2 ON t1.paperid = t2.paperid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = "Google"
Find all the papers published by the institution "Google".
icfp_1
SELECT count(DISTINCT t1.title) FROM papers AS t1 JOIN authorship AS t2 ON t1.paperid = t2.paperid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = "Tokohu University"
How many papers are published by the institution "Tokohu University"?
icfp_1
SELECT count(DISTINCT t1.title) FROM papers AS t1 JOIN authorship AS t2 ON t1.paperid = t2.paperid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = "University of Pennsylvania"
Find the number of papers published by the institution "University of Pennsylvania".
icfp_1
SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t1.fname = "Olin" AND t1.lname = "Shivers"
Find the papers which have "Olin Shivers" as an author.
icfp_1
SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t1.fname = "Stephanie" AND t1.lname = "Weirich"
Which papers have "Stephanie Weirich" as an author?
icfp_1
SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid JOIN inst AS t4 ON t2.instid = t4.instid WHERE t4.country = "USA" AND t2.authorder = 2 AND t1.lname = "Turon"
Which paper is published in an institution in "USA" and have "Turon" as its second author?
icfp_1
SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid JOIN inst AS t4 ON t2.instid = t4.instid WHERE t4.country = "Japan" AND t2.authorder = 1 AND t1.lname = "Ohori"
Find the titles of papers whose first author is affiliated with an institution in the country "Japan" and has last name "Ohori"?
icfp_1
SELECT t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid GROUP BY t1.fname , t1.lname ORDER BY count(*) DESC LIMIT 1
What is the last name of the author that has published the most papers?
icfp_1
SELECT t1.country FROM inst AS t1 JOIN authorship AS t2 ON t1.instid = t2.instid JOIN papers AS t3 ON t2.paperid = t3.paperid GROUP BY t1.country ORDER BY count(*) DESC LIMIT 1
Retrieve the country that has published the most papers.
icfp_1
SELECT t1.name FROM inst AS t1 JOIN authorship AS t2 ON t1.instid = t2.instid JOIN papers AS t3 ON t2.paperid = t3.paperid GROUP BY t1.name ORDER BY count(*) DESC LIMIT 1
Find the name of the organization that has published the largest number of papers.
icfp_1
SELECT title FROM papers WHERE title LIKE "%ML%"
Find the titles of the papers that contain the word "ML".
icfp_1
SELECT title FROM papers WHERE title LIKE "%Database%"
Which paper's title contains the word "Database"?
icfp_1
SELECT t1.fname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t3.title LIKE "%Functional%"
Find the first names of all the authors who have written a paper with title containing the word "Functional".
icfp_1
SELECT t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t3.title LIKE "%Monadic%"
Find the last names of all the authors that have written a paper with title containing the word "Monadic".
customers_card_transactions
SELECT T2.customer_first_name , T2.customer_last_name , T2.customer_phone FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T1.account_name = "162"
What is the first name, last name, and phone of the customer with account name 162?
customers_card_transactions
SELECT count(*) FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = "Art" AND T2.customer_last_name = "Turcotte"
How many accounts does the customer with first name Art and last name Turcotte have?
customers_card_transactions
SELECT customer_id , count(*) FROM Accounts GROUP BY customer_id ORDER BY count(*) DESC LIMIT 1
Show the customer id and number of accounts with most accounts.
customers_card_transactions
SELECT T2.customer_first_name , T2.customer_last_name , T1.customer_id FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY count(*) ASC LIMIT 1
What is the customer first, last name and id with least number of accounts.
customers_card_transactions
SELECT count(*) FROM Customers WHERE customer_id NOT IN (SELECT customer_id FROM Accounts)
Show the number of all customers without an account.
customers_card_transactions
SELECT customer_first_name , customer_last_name FROM Customers EXCEPT SELECT T1.customer_first_name , T1.customer_last_name FROM Customers AS T1 JOIN Accounts AS T2 ON T1.customer_id = T2.customer_id
Show the first names and last names of customers without any account.
customers_card_transactions
SELECT customer_phone , customer_email FROM Customers WHERE customer_first_name = "Aniyah" AND customer_last_name = "Feest"
What is the phone and email for customer with first name Aniyah and last name Feest?
customers_card_transactions
SELECT T2.customer_first_name , T2.customer_last_name , T2.customer_phone FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T1.card_number = "4560596484842"
What is the first name, last name, and phone of the customer with card 4560596484842.
customers_card_transactions
SELECT count(*) FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = "Art" AND T2.customer_last_name = "Turcotte"
How many cards does customer Art Turcotte have?
local_govt_in_alabama
SELECT T1.event_details FROM EVENTS AS T1 JOIN Services AS T2 ON T1.Service_ID = T2.Service_ID WHERE T2.Service_Type_Code = 'Marriage'
what are the event details of the services that have the type code 'Marriage'?
local_govt_in_alabama
SELECT T1.event_id , T1.event_details FROM EVENTS AS T1 JOIN Participants_in_Events AS T2 ON T1.Event_ID = T2.Event_ID GROUP BY T1.Event_ID HAVING count(*) > 1
What are the ids and details of events that have more than one participants?
local_govt_in_alabama
SELECT T1.Participant_ID , T1.Participant_Type_Code , count(*) FROM Participants AS T1 JOIN Participants_in_Events AS T2 ON T1.Participant_ID = T2.Participant_ID GROUP BY T1.Participant_ID
How many events have each participants attended? List the participant id, type and the number.
local_govt_in_alabama
SELECT Participant_ID , Participant_Type_Code , Participant_Details FROM Participants
What are all the the participant ids, type code and details?
local_govt_in_alabama
SELECT count(*) FROM participants WHERE participant_type_code = 'Organizer'
How many participants belong to the type 'Organizer'?
local_govt_in_alabama
SELECT service_type_code FROM services ORDER BY service_type_code
List the type of the services in alphabetical order.
local_govt_in_alabama
SELECT service_id , event_details FROM EVENTS
List the service id and details for the events.
local_govt_in_alabama
SELECT count(*) FROM participants AS T1 JOIN Participants_in_Events AS T2 ON T1.Participant_ID = T2.Participant_ID WHERE T1.participant_details LIKE '%Dr.%'
How many events had participants whose details had the substring 'Dr.'
local_govt_in_alabama
SELECT participant_type_code FROM participants GROUP BY participant_type_code ORDER BY count(*) DESC LIMIT 1
What is the most common participant type?
local_govt_in_alabama
SELECT T3.service_id , T4.Service_Type_Code FROM participants AS T1 JOIN Participants_in_Events AS T2 ON T1.Participant_ID = T2.Participant_ID JOIN EVENTS AS T3 ON T2.Event_ID = T3.Event_ID JOIN services AS T4 ON T3.service_id = T4.service_id GROUP BY T3.service_id ORDER BY count(*) ASC LIMIT 1
Which service id and type has the least number of participants?
local_govt_in_alabama
SELECT Event_ID FROM Participants_in_Events GROUP BY Event_ID ORDER BY count(*) DESC LIMIT 1
What is the id of the event with the most participants?
local_govt_in_alabama
SELECT event_id FROM EVENTS EXCEPT SELECT T1.event_id FROM Participants_in_Events AS T1 JOIN Participants AS T2 ON T1.Participant_ID = T2.Participant_ID WHERE Participant_Details = 'Kenyatta Kuhn'
Which events id does not have any participant with detail 'Kenyatta Kuhn'?
local_govt_in_alabama
SELECT T1.service_type_code FROM services AS T1 JOIN EVENTS AS T2 ON T1.service_id = T2.service_id WHERE T2.event_details = 'Success' INTERSECT SELECT T1.service_type_code FROM services AS T1 JOIN EVENTS AS T2 ON T1.service_id = T2.service_id WHERE T2.event_details = 'Fail'
Which services type had both successful and failure event details?
local_govt_in_alabama
SELECT count(*) FROM EVENTS WHERE event_id NOT IN (SELECT event_id FROM Participants_in_Events)
How many events did not have any participants?
body_builder
SELECT count(*) FROM body_builder
How many body builders are there?
body_builder
SELECT Total FROM body_builder ORDER BY Total ASC
List the total scores of body builders in ascending order.
body_builder
SELECT Snatch , Clean_Jerk FROM body_builder ORDER BY Snatch ASC
List the snatch score and clean jerk score of body builders in ascending order of snatch score.
body_builder
SELECT avg(Snatch) FROM body_builder
What is the average snatch score of body builders?
body_builder
SELECT Clean_Jerk FROM body_builder ORDER BY Total DESC LIMIT 1
What are the clean and jerk score of the body builder with the highest total score?
body_builder
SELECT Birth_Date FROM People ORDER BY Height ASC
What are the birthdays of people in ascending order of height?
body_builder
SELECT T2.Name FROM body_builder AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID
What are the names of body builders?
body_builder
SELECT T2.Name FROM body_builder AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID WHERE T1.Total > 300
What are the names of body builders whose total score is higher than 300?
body_builder
SELECT T2.Name FROM body_builder AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID ORDER BY T2.Weight DESC LIMIT 1
What is the name of the body builder with the greatest body weight?
body_builder
SELECT T2.Birth_Date , T2.Birth_Place FROM body_builder AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID ORDER BY T1.Total DESC LIMIT 1
What are the birth date and birth place of the body builder with the highest total points?
body_builder
SELECT T2.Height FROM body_builder AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID WHERE T1.Total < 315
What are the heights of body builders with total score smaller than 315?
body_builder
SELECT avg(T1.Total) FROM body_builder AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID WHERE T2.Height > 200
What is the average total score of body builders with height bigger than 200?
body_builder
SELECT T2.Name FROM body_builder AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID ORDER BY T1.Total DESC
What are the names of body builders in descending order of total scores?
body_builder
SELECT Birth_Place, COUNT(*) FROM people GROUP BY Birth_Place
List each birth place along with the number of people from there.
body_builder
SELECT Birth_Place FROM people GROUP BY Birth_Place ORDER BY COUNT(*) DESC LIMIT 1
What is the most common birth place of people?
body_builder
SELECT Birth_Place FROM people GROUP BY Birth_Place HAVING COUNT(*) >= 2
What are the birth places that are shared by at least two people?
body_builder
SELECT Height , Weight FROM people ORDER BY Height DESC
List the height and weight of people in descending order of height.
body_builder
SELECT * FROM body_builder
Show all information about each body builder.
body_builder
SELECT Name , birth_place FROM people EXCEPT SELECT T1.Name , T1.birth_place FROM people AS T1 JOIN body_builder AS T2 ON T1.people_id = T2.people_id
List the names and origins of people who are not body builders.
body_builder
SELECT count(DISTINCT Birth_Place) FROM people
How many distinct birth places are there?
body_builder
SELECT count(*) FROM people WHERE people_id NOT IN (SELECT People_ID FROM body_builder)
How many persons are not body builders?
body_builder
SELECT T2.weight FROM body_builder AS T1 JOIN people AS T2 ON T1.people_id = T2.people_id WHERE T1.snatch > 140 OR T2.height > 200;
List the weight of the body builders who have snatch score higher than 140 or have the height greater than 200.
body_builder
SELECT T1.total FROM body_builder AS T1 JOIN people AS T2 ON T1.people_id = T2.people_id WHERE T2.Birth_Date LIKE "%January%";
What are the total scores of the body builders whose birthday contains the string "January" ?
pilot_record
SELECT count(*) FROM pilot
How many pilots are there?
pilot_record
SELECT Pilot_name FROM pilot ORDER BY Rank ASC
List the names of pilots in ascending order of rank.
pilot_record
SELECT POSITION , Team FROM pilot
What are the positions and teams of pilots?
pilot_record
SELECT DISTINCT POSITION FROM pilot WHERE Age > 30
List the distinct positions of pilots older than 30.
pilot_record
SELECT Pilot_name FROM pilot WHERE Team = "Bradley" OR Team = "Fordham"
Show the names of pilots from team "Bradley" or "Fordham".
pilot_record
SELECT Join_Year FROM pilot ORDER BY Rank ASC LIMIT 1
What is the joined year of the pilot of the highest rank?
pilot_record
SELECT Nationality , COUNT(*) FROM pilot GROUP BY Nationality
What are the different nationalities of pilots? Show each nationality and the number of pilots of each nationality.
pilot_record
SELECT Nationality FROM pilot GROUP BY Nationality ORDER BY COUNT(*) DESC LIMIT 1
Show the most common nationality of pilots.
pilot_record
SELECT POSITION FROM pilot WHERE Join_Year < 2000 INTERSECT SELECT POSITION FROM pilot WHERE Join_Year > 2005
Show the pilot positions that have both pilots joining after year 2005 and pilots joining before 2000.
pilot_record
SELECT T3.Pilot_name , T2.Model FROM pilot_record AS T1 JOIN aircraft AS T2 ON T1.Aircraft_ID = T2.Aircraft_ID JOIN pilot AS T3 ON T1.Pilot_ID = T3.Pilot_ID
Show the names of pilots and models of aircrafts they have flied with.
pilot_record
SELECT T3.Pilot_name , T2.Fleet_Series FROM pilot_record AS T1 JOIN aircraft AS T2 ON T1.Aircraft_ID = T2.Aircraft_ID JOIN pilot AS T3 ON T1.Pilot_ID = T3.Pilot_ID ORDER BY T3.Rank
Show the names of pilots and fleet series of the aircrafts they have flied with in ascending order of the rank of the pilot.
pilot_record
SELECT T2.Fleet_Series FROM pilot_record AS T1 JOIN aircraft AS T2 ON T1.Aircraft_ID = T2.Aircraft_ID JOIN pilot AS T3 ON T1.Pilot_ID = T3.Pilot_ID WHERE T3.Age < 34
Show the fleet series of the aircrafts flied by pilots younger than 34
pilot_record
SELECT T2.Pilot_name , COUNT(*) FROM pilot_record AS T1 JOIN pilot AS T2 ON T1.pilot_ID = T2.pilot_ID GROUP BY T2.Pilot_name
Show the names of pilots and the number of records they have.
pilot_record
SELECT T2.Pilot_name , COUNT(*) FROM pilot_record AS T1 JOIN pilot AS T2 ON T1.pilot_ID = T2.pilot_ID GROUP BY T2.Pilot_name HAVING COUNT(*) > 1
Show names of pilots that have more than one record.