query_id
int64
0
2.15k
database_id
stringclasses
40 values
table_id
sequencelengths
1
4
query
stringlengths
22
185
answer
stringlengths
22
608
difficulty
stringclasses
4 values
2,000
book_press
[ "author", "book" ]
Which authors in the record have not published any books ? Give me their names .
select name from author where author_id not in (select author_id from book)
hard
2,001
book_press
[ "author", "book" ]
Find the names of authors who have more than one book in the database.
SELECT t1.name FROM author AS t1 JOIN book AS t2 ON t1.author_id = t2.author_id GROUP BY t2.author_id HAVING count(*) > 1
medium
2,002
book_press
[ "author", "book" ]
Which authors have published more than 1 book according to the database? Give me their names.
SELECT t1.name FROM author AS t1 JOIN book AS t2 ON t1.author_id = t2.author_id GROUP BY t2.author_id HAVING count(*) > 1
medium
2,003
book_press
[ "author", "book", "press" ]
Find the title, author name, and publisher name for the top 3 best sales books.
SELECT t1.name , t2.title , t3.name FROM author AS t1 JOIN book AS t2 ON t1.author_id = t2.author_id JOIN press AS t3 ON t2.press_id = t3.press_id ORDER BY t2.sale_amount DESC LIMIT 3
extra
2,004
book_press
[ "author", "book", "press" ]
What are the 3 best selling books? Show their titles, author names, and press names.
SELECT t1.name , t2.title , t3.name FROM author AS t1 JOIN book AS t2 ON t1.author_id = t2.author_id JOIN press AS t3 ON t2.press_id = t3.press_id ORDER BY t2.sale_amount DESC LIMIT 3
extra
2,005
book_press
[ "book", "press" ]
Find the name and total book sale amount of each press.
SELECT sum(t1.sale_amount) , t2.name FROM book AS t1 JOIN press AS t2 ON t1.press_id = t2.press_id GROUP BY t1.press_id
medium
2,006
book_press
[ "book", "press" ]
What are the name and total book sale amount of each press?
SELECT sum(t1.sale_amount) , t2.name FROM book AS t1 JOIN press AS t2 ON t1.press_id = t2.press_id GROUP BY t1.press_id
medium
2,007
book_press
[ "book", "press" ]
Find the number of books that are sold more than 1000 for each publisher. List the press name as well.
SELECT count(*) , t2.name FROM book AS t1 JOIN press AS t2 ON t1.press_id = t2.press_id WHERE sale_amount > 1000 GROUP BY t2.name
hard
2,008
book_press
[ "book", "press" ]
For each press, return its name and the number of books that have sale amount above 1000.
SELECT count(*) , t2.name FROM book AS t1 JOIN press AS t2 ON t1.press_id = t2.press_id WHERE sale_amount > 1000 GROUP BY t2.name
hard
2,009
book_press
[ "author", "book" ]
What is the name of the author of best selling book?
SELECT t1.name FROM author AS t1 JOIN book AS t2 ON t1.author_id = t2.author_id ORDER BY t2.sale_amount DESC LIMIT 1
hard
2,010
book_press
[ "author", "book" ]
Who wrote the best selling book? Give me the author name.
SELECT t1.name FROM author AS t1 JOIN book AS t2 ON t1.author_id = t2.author_id ORDER BY t2.sale_amount DESC LIMIT 1
hard
2,011
book_press
[ "author", "book" ]
find the name and gender of the author who published the most books.
SELECT t1.name , t1.gender FROM author AS t1 JOIN book AS t2 ON t1.author_id = t2.author_id GROUP BY t2.author_id ORDER BY count(*) DESC LIMIT 1
extra
2,012
book_press
[ "author", "book" ]
Who wrote the largest number of books? Give me the author name and gender.
SELECT t1.name , t1.gender FROM author AS t1 JOIN book AS t2 ON t1.author_id = t2.author_id GROUP BY t2.author_id ORDER BY count(*) DESC LIMIT 1
extra
2,013
book_press
[ "author", "book", "press" ]
Find the names of the authors who did not have any book with the "Accor" press.
SELECT name FROM author EXCEPT SELECT t1.name FROM author AS t1 JOIN book AS t2 ON t1.author_id = t2.author_id JOIN press AS t3 ON t2.press_id = t3.press_id WHERE t3.name = 'Accor'
hard
2,014
book_press
[ "author", "book", "press" ]
Which authors have never published under the "Accor" press? Give me their names.
SELECT name FROM author EXCEPT SELECT t1.name FROM author AS t1 JOIN book AS t2 ON t1.author_id = t2.author_id JOIN press AS t3 ON t2.press_id = t3.press_id WHERE t3.name = 'Accor'
hard
2,015
book_press
[ "book", "press" ]
Find the name and the yearly profit in billion for press that published more than two books.
SELECT t2.name , t2.Year_Profits_billion FROM book AS t1 JOIN press AS t2 ON t1.press_id = t2.press_id GROUP BY t2.press_id HAVING count(*) > 2
medium
2,016
book_press
[ "book", "press" ]
Find the press that published more than two books, and return its name and yearly profit in billion.
SELECT t2.name , t2.Year_Profits_billion FROM book AS t1 JOIN press AS t2 ON t1.press_id = t2.press_id GROUP BY t2.press_id HAVING count(*) > 2
medium
2,017
cre_Doc_Workflow
[ "Authors" ]
How many authors do we have?
SELECT count(*) FROM Authors
easy
2,018
cre_Doc_Workflow
[ "Authors" ]
Show all author names.
SELECT author_name FROM Authors
easy
2,019
cre_Doc_Workflow
[ "Authors" ]
Show the names and other details for all authors.
SELECT author_name , other_details FROM Authors
medium
2,020
cre_Doc_Workflow
[ "Authors" ]
Show the other details for the author Addison Denesik.
SELECT other_details FROM Authors WHERE author_name = "Addison Denesik"
easy
2,021
cre_Doc_Workflow
[ "Documents" ]
Show the number of documents.
SELECT count(*) FROM Documents
easy
2,022
cre_Doc_Workflow
[ "Documents" ]
Who is the author of the document with id 4?
SELECT author_name FROM Documents WHERE document_id = 4
easy
2,023
cre_Doc_Workflow
[ "Documents" ]
Who is the author of the document "Travel to Brazil"?
SELECT author_name FROM Documents WHERE document_name = "Travel to Brazil"
easy
2,024
cre_Doc_Workflow
[ "Documents" ]
How many documents does has the author Era Kerluke written?
SELECT count(*) FROM Documents WHERE author_name = "Era Kerluke"
easy
2,025
cre_Doc_Workflow
[ "Documents" ]
Show the names and descriptions for all documents.
SELECT document_name , document_description FROM Documents
medium
2,026
cre_Doc_Workflow
[ "Documents" ]
Show the ids and names for all documents by author Bianka Cummings.
SELECT document_id , document_name FROM Documents WHERE author_name = "Bianka Cummings"
medium
2,027
cre_Doc_Workflow
[ "Documents", "Authors" ]
Show the author name and details for the document "Travel to China".
SELECT T2.author_name , T2.other_details FROM Documents AS T1 JOIN Authors AS T2 ON T1.author_name = T2.author_name WHERE document_name = "Travel to China"
medium
2,028
cre_Doc_Workflow
[ "Documents" ]
Show all author names and number of documents corresponding to each.
SELECT author_name , count(*) FROM Documents GROUP BY author_name
medium
2,029
cre_Doc_Workflow
[ "Documents" ]
What is the name of the author with most number of documents?
SELECT author_name FROM Documents GROUP BY author_name ORDER BY count(*) DESC LIMIT 1
hard
2,030
cre_Doc_Workflow
[ "Documents" ]
Show the names for authors with at least two documents.
SELECT author_name FROM Documents GROUP BY author_name HAVING count(*) >= 2
easy
2,031
cre_Doc_Workflow
[ "Business_processes" ]
How many business processes do we have?
SELECT count(*) FROM Business_processes
easy
2,032
cre_Doc_Workflow
[ "Business_processes" ]
Show the next process id, process name, process description for process with id 9.
SELECT next_process_id , process_name , process_description FROM Business_processes WHERE process_id = 9
medium
2,033
cre_Doc_Workflow
[ "Business_processes" ]
What is the process name for the next process of the process with id 9?
SELECT process_name FROM Business_processes WHERE process_id = (SELECT next_process_id FROM Business_processes WHERE process_id = 9)
hard
2,034
cre_Doc_Workflow
[ "Process_outcomes" ]
Show the number of process outcomes.
SELECT count(*) FROM Process_outcomes
easy
2,035
cre_Doc_Workflow
[ "Process_outcomes" ]
List the codes and descriptions for all process outcomes.
SELECT process_outcome_code , process_outcome_description FROM Process_outcomes
medium
2,036
cre_Doc_Workflow
[ "Process_outcomes" ]
What is the description for the process outcome code working?
SELECT process_outcome_description FROM Process_outcomes WHERE process_outcome_code = "working"
easy
2,037
cre_Doc_Workflow
[ "Process_status" ]
Show the number of process status.
SELECT count(*) FROM Process_status
easy
2,038
cre_Doc_Workflow
[ "Process_status" ]
List the codes and descriptions for all process status.
SELECT process_status_code , process_status_description FROM Process_status
medium
2,039
cre_Doc_Workflow
[ "Process_status" ]
What is the description for process status code ct?
SELECT process_status_description FROM Process_status WHERE process_status_code = "ct"
easy
2,040
cre_Doc_Workflow
[ "Staff" ]
How many staff do we have?
SELECT count(*) FROM Staff
easy
2,041
cre_Doc_Workflow
[ "Staff" ]
Show the ids and details for all staff.
SELECT staff_id , staff_details FROM Staff
medium
2,042
cre_Doc_Workflow
[ "Staff" ]
What are the details for the staff member with id 100.
SELECT staff_details FROM Staff WHERE staff_id = 100
easy
2,043
cre_Doc_Workflow
[ "Ref_staff_roles" ]
Show the number of staff roles.
SELECT count(*) FROM Ref_staff_roles
easy
2,044
cre_Doc_Workflow
[ "Ref_staff_roles" ]
List the codes and descriptions for all staff roles.
SELECT staff_role_code , staff_role_description FROM Ref_staff_roles
medium
2,045
cre_Doc_Workflow
[ "Ref_staff_roles" ]
What is the description for staff role code HR?
SELECT staff_role_description FROM Ref_staff_roles WHERE staff_role_code = "HR"
easy
2,046
cre_Doc_Workflow
[ "Documents_processes" ]
How many documents have a process?
SELECT count(DISTINCT document_id) FROM Documents_processes
easy
2,047
cre_Doc_Workflow
[ "Documents_processes" ]
List all process ids with a document.
SELECT DISTINCT process_id FROM Documents_processes
easy
2,048
cre_Doc_Workflow
[ "Documents", "Documents_processes" ]
Show all document ids without a process.
SELECT document_id FROM Documents EXCEPT SELECT document_id FROM Documents_processes
hard
2,049
cre_Doc_Workflow
[ "Business_processes", "Documents_processes" ]
List all process ids with no document.
SELECT process_id FROM Business_processes EXCEPT SELECT process_id FROM Documents_processes
hard
2,050
cre_Doc_Workflow
[ "Process_Status", "Documents_processes", "Process_outcomes" ]
What is the process outcome description and process status description for the document with id 0?
SELECT T2.process_outcome_description , T3.process_status_description FROM Documents_processes AS T1 JOIN Process_outcomes AS T2 ON T1.process_outcome_code = T2.process_outcome_code JOIN Process_Status AS T3 ON T1.process_status_code = T3.process_status_code WHERE T1.document_id = 0
hard
2,051
cre_Doc_Workflow
[ "Business_processes", "Documents", "Documents_processes" ]
What is the process name for the document "Travel to Brazil"?
SELECT T3.process_name FROM Documents_processes AS T1 JOIN Documents AS T2 ON T1.document_id = T2.document_id JOIN Business_processes AS T3 ON T1.process_id = T3.process_id WHERE T2.document_name = "Travel to Brazil"
hard
2,052
cre_Doc_Workflow
[ "Documents_processes" ]
Show all process ids and the number of documents in each process.
SELECT process_id , count(*) FROM Documents_processes GROUP BY process_id
medium
2,053
cre_Doc_Workflow
[ "Staff_in_processes" ]
How many staff are the document with id 0 and process with id 9.
SELECT count(*) FROM Staff_in_processes WHERE document_id = 0 AND process_id = 9
medium
2,054
cre_Doc_Workflow
[ "Staff_in_processes" ]
Show all staff ids and the number of document processes for each staff.
SELECT staff_id , count(*) FROM Staff_in_processes GROUP BY staff_id
medium
2,055
cre_Doc_Workflow
[ "Staff_in_processes" ]
Show all staff role codes and the number of document processes for each role.
SELECT staff_role_code , count(*) FROM Staff_in_processes GROUP BY staff_role_code
medium
2,056
cre_Doc_Workflow
[ "Staff_in_processes" ]
How many different roles does the staff with id 3 have?
SELECT count(DISTINCT staff_role_code) FROM Staff_in_processes WHERE staff_id = 3
easy
2,057
advertising_agencies
[ "Agencies" ]
How many agencies do we have?
SELECT count(*) FROM Agencies
easy
2,058
advertising_agencies
[ "Agencies" ]
Count the number of agencies.
SELECT count(*) FROM Agencies
easy
2,059
advertising_agencies
[ "Agencies" ]
Show all agency ids and details.
SELECT agency_id , agency_details FROM Agencies
medium
2,060
advertising_agencies
[ "Agencies" ]
What are all the agency ids and details?
SELECT agency_id , agency_details FROM Agencies
medium
2,061
advertising_agencies
[ "Clients" ]
Show the number of clients.
SELECT count(*) FROM Clients
easy
2,062
advertising_agencies
[ "Clients" ]
How many clients are there?
SELECT count(*) FROM Clients
easy
2,063
advertising_agencies
[ "Clients" ]
List all client ids and client details.
SELECT client_id , client_details FROM Clients
medium
2,064
advertising_agencies
[ "Clients" ]
What are all the client ids and details?
SELECT client_id , client_details FROM Clients
medium
2,065
advertising_agencies
[ "Clients" ]
Show agency ids and the number of clients for each agency.
SELECT agency_id , count(*) FROM Clients GROUP BY agency_id
medium
2,066
advertising_agencies
[ "Clients" ]
How many clients does each agency have?
SELECT agency_id , count(*) FROM Clients GROUP BY agency_id
medium
2,067
advertising_agencies
[ "Agencies", "Clients" ]
What is the agency id and details with most number of clients?
SELECT T1.agency_id , T1.agency_details FROM Agencies AS T1 JOIN Clients AS T2 ON T1.agency_id = T2.agency_id GROUP BY T1.agency_id ORDER BY count(*) DESC LIMIT 1
extra
2,068
advertising_agencies
[ "Agencies", "Clients" ]
Return the agency id and details for the agency with the greatest number of clients.
SELECT T1.agency_id , T1.agency_details FROM Agencies AS T1 JOIN Clients AS T2 ON T1.agency_id = T2.agency_id GROUP BY T1.agency_id ORDER BY count(*) DESC LIMIT 1
extra
2,069
advertising_agencies
[ "Agencies", "Clients" ]
Show agency ids and details with at least 2 clients.
SELECT T1.agency_id , T1.agency_details FROM Agencies AS T1 JOIN Clients AS T2 ON T1.agency_id = T2.agency_id GROUP BY T1.agency_id HAVING count(*) >= 2
medium
2,070
advertising_agencies
[ "Agencies", "Clients" ]
What are the agency ids and details agencies with at least 2 clients?
SELECT T1.agency_id , T1.agency_details FROM Agencies AS T1 JOIN Clients AS T2 ON T1.agency_id = T2.agency_id GROUP BY T1.agency_id HAVING count(*) >= 2
medium
2,071
advertising_agencies
[ "Agencies", "Clients" ]
Show agency details for client with detail 'Mac'.
SELECT T2.agency_details FROM Clients AS T1 JOIN Agencies AS T2 ON T1.agency_id = T2.agency_id WHERE T1.client_details = 'Mac'
medium
2,072
advertising_agencies
[ "Agencies", "Clients" ]
What are the agency details for clients with the detail Mac?
SELECT T2.agency_details FROM Clients AS T1 JOIN Agencies AS T2 ON T1.agency_id = T2.agency_id WHERE T1.client_details = 'Mac'
medium
2,073
advertising_agencies
[ "Agencies", "Clients" ]
Show details for all clients and the details of their corresponding agents.
SELECT T1.client_details , T2.agency_details FROM Clients AS T1 JOIN Agencies AS T2 ON T1.agency_id = T2.agency_id
medium
2,074
advertising_agencies
[ "Agencies", "Clients" ]
What are the client details for each client and the corresponding details of their agencies?
SELECT T1.client_details , T2.agency_details FROM Clients AS T1 JOIN Agencies AS T2 ON T1.agency_id = T2.agency_id
medium
2,075
advertising_agencies
[ "Clients" ]
Show all sic codes and the number of clients with each code.
SELECT sic_code , count(*) FROM Clients GROUP BY sic_code
medium
2,076
advertising_agencies
[ "Clients" ]
How many clients are there for each sic code?
SELECT sic_code , count(*) FROM Clients GROUP BY sic_code
medium
2,077
advertising_agencies
[ "Clients" ]
Show all client ids and details with sic code "Bad".
SELECT client_id , client_details FROM Clients WHERE sic_code = "Bad";
medium
2,078
advertising_agencies
[ "Clients" ]
What are the client ideas and details for clients with the sic code Bad?
SELECT client_id , client_details FROM Clients WHERE sic_code = "Bad";
medium
2,079
advertising_agencies
[ "Agencies", "Clients" ]
Show all agency ids and details for agencies with a client.
SELECT T1.agency_id , T1.agency_details FROM Agencies AS T1 JOIN Clients AS T2 ON T1.agency_id = T2.agency_id
medium
2,080
advertising_agencies
[ "Agencies", "Clients" ]
What are the agency ids and agency details for all agencies who have a client?
SELECT T1.agency_id , T1.agency_details FROM Agencies AS T1 JOIN Clients AS T2 ON T1.agency_id = T2.agency_id
medium
2,081
advertising_agencies
[ "Agencies", "Clients" ]
Show all agency ids without any client.
SELECT agency_id FROM Agencies EXCEPT SELECT agency_id FROM Clients
hard
2,082
advertising_agencies
[ "Agencies", "Clients" ]
What are ids of agencies that do not have any clients?
SELECT agency_id FROM Agencies EXCEPT SELECT agency_id FROM Clients
hard
2,083
advertising_agencies
[ "Invoices" ]
How many invoices do we have?
SELECT count(*) FROM Invoices
easy
2,084
advertising_agencies
[ "Invoices" ]
Count the number of invoices.
SELECT count(*) FROM Invoices
easy
2,085
advertising_agencies
[ "Invoices" ]
Show ids, status codes, and details for all invoices for clients.
SELECT invoice_id , invoice_status , invoice_details FROM Invoices
medium
2,086
advertising_agencies
[ "Invoices" ]
What are the ids, statuses, and details for all invoices?
SELECT invoice_id , invoice_status , invoice_details FROM Invoices
medium
2,087
advertising_agencies
[ "Invoices" ]
Show all client ids and the number of invoices for each client.
SELECT client_id , count(*) FROM Invoices GROUP BY client_id
medium
2,088
advertising_agencies
[ "Invoices" ]
How many invoices are there for each client id?
SELECT client_id , count(*) FROM Invoices GROUP BY client_id
medium
2,089
advertising_agencies
[ "Clients", "Invoices" ]
List the client id and detail with most number of invoices.
SELECT T1.client_id , T2.client_details FROM Invoices AS T1 JOIN Clients AS T2 ON T1.client_id = T2.client_id GROUP BY T1.client_id ORDER BY count(*) DESC LIMIT 1
extra
2,090
advertising_agencies
[ "Clients", "Invoices" ]
What are the client id and details for the client with the most invoices?
SELECT T1.client_id , T2.client_details FROM Invoices AS T1 JOIN Clients AS T2 ON T1.client_id = T2.client_id GROUP BY T1.client_id ORDER BY count(*) DESC LIMIT 1
extra
2,091
advertising_agencies
[ "Invoices" ]
What are client ids for clients with at least 2 invoices.
SELECT client_id FROM Invoices GROUP BY client_id HAVING count(*) >= 2
easy
2,092
advertising_agencies
[ "Invoices" ]
Return the client ids for clients with two or more invoices?
SELECT client_id FROM Invoices GROUP BY client_id HAVING count(*) >= 2
easy
2,093
advertising_agencies
[ "Invoices" ]
Show all invoice status codes and the number of invoices with each status.
SELECT invoice_status , count(*) FROM Invoices GROUP BY invoice_status
medium
2,094
advertising_agencies
[ "Invoices" ]
How many invoices are there for each status code?
SELECT invoice_status , count(*) FROM Invoices GROUP BY invoice_status
medium
2,095
advertising_agencies
[ "Invoices" ]
What is the invoice status code with most number of invoices.
SELECT invoice_status FROM Invoices GROUP BY invoice_status ORDER BY count(*) DESC LIMIT 1
hard
2,096
advertising_agencies
[ "Invoices" ]
Return the invoice status that has the most invoices.
SELECT invoice_status FROM Invoices GROUP BY invoice_status ORDER BY count(*) DESC LIMIT 1
hard
2,097
advertising_agencies
[ "Agencies", "Clients", "Invoices" ]
Show all invoice status codes and details and the corresponding client id and details and agency id and details.
SELECT T1.invoice_status , T1.invoice_details , T2.client_id , T2.client_details , T3.agency_id , T3.agency_details FROM Invoices AS T1 JOIN Clients AS T2 ON T1.client_id = T2.client_id JOIN Agencies AS T3 ON T2.agency_id = T3.agency_id
medium
2,098
advertising_agencies
[ "Agencies", "Clients", "Invoices" ]
What are the invoice status, invoice details, and corresponding client ids and details and agency id and details?
SELECT T1.invoice_status , T1.invoice_details , T2.client_id , T2.client_details , T3.agency_id , T3.agency_details FROM Invoices AS T1 JOIN Clients AS T2 ON T1.client_id = T2.client_id JOIN Agencies AS T3 ON T2.agency_id = T3.agency_id
medium
2,099
advertising_agencies
[ "meetings" ]
List all meeting type codes and details.
SELECT meeting_type , other_details FROM meetings
medium