db_id
stringclasses
40 values
query
stringlengths
22
608
question
stringlengths
22
185
book_press
select name from author where author_id not in (select author_id from book)
Which authors in the record have not published any books ? Give me their names .
book_press
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
Find the names of authors who have more than one book in the database.
book_press
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
Which authors have published more than 1 book according to the database? Give me their names.
book_press
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
Find the title, author name, and publisher name for the top 3 best sales books.
book_press
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
What are the 3 best selling books? Show their titles, author names, and press names.
book_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
Find the name and total book sale amount of each press.
book_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
What are the name and total book sale amount of each press?
book_press
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
Find the number of books that are sold more than 1000 for each publisher. List the press name as well.
book_press
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
For each press, return its name and the number of books that have sale amount above 1000.
book_press
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
What is the name of the author of best selling book?
book_press
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
Who wrote the best selling book? Give me the author name.
book_press
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
find the name and gender of the author who published the most books.
book_press
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
Who wrote the largest number of books? Give me the author name and gender.
book_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'
Find the names of the authors who did not have any book with the "Accor" press.
book_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'
Which authors have never published under the "Accor" press? Give me their names.
book_press
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
Find the name and the yearly profit in billion for press that published more than two books.
book_press
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
Find the press that published more than two books, and return its name and yearly profit in billion.
cre_Doc_Workflow
SELECT count(*) FROM Authors
How many authors do we have?
cre_Doc_Workflow
SELECT author_name FROM Authors
Show all author names.
cre_Doc_Workflow
SELECT author_name , other_details FROM Authors
Show the names and other details for all authors.
cre_Doc_Workflow
SELECT other_details FROM Authors WHERE author_name = "Addison Denesik"
Show the other details for the author Addison Denesik.
cre_Doc_Workflow
SELECT count(*) FROM Documents
Show the number of documents.
cre_Doc_Workflow
SELECT author_name FROM Documents WHERE document_id = 4
Who is the author of the document with id 4?
cre_Doc_Workflow
SELECT author_name FROM Documents WHERE document_name = "Travel to Brazil"
Who is the author of the document "Travel to Brazil"?
cre_Doc_Workflow
SELECT count(*) FROM Documents WHERE author_name = "Era Kerluke"
How many documents does has the author Era Kerluke written?
cre_Doc_Workflow
SELECT document_name , document_description FROM Documents
Show the names and descriptions for all documents.
cre_Doc_Workflow
SELECT document_id , document_name FROM Documents WHERE author_name = "Bianka Cummings"
Show the ids and names for all documents by author Bianka Cummings.
cre_Doc_Workflow
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"
Show the author name and details for the document "Travel to China".
cre_Doc_Workflow
SELECT author_name , count(*) FROM Documents GROUP BY author_name
Show all author names and number of documents corresponding to each.
cre_Doc_Workflow
SELECT author_name FROM Documents GROUP BY author_name ORDER BY count(*) DESC LIMIT 1
What is the name of the author with most number of documents?
cre_Doc_Workflow
SELECT author_name FROM Documents GROUP BY author_name HAVING count(*) >= 2
Show the names for authors with at least two documents.
cre_Doc_Workflow
SELECT count(*) FROM Business_processes
How many business processes do we have?
cre_Doc_Workflow
SELECT next_process_id , process_name , process_description FROM Business_processes WHERE process_id = 9
Show the next process id, process name, process description for process with id 9.
cre_Doc_Workflow
SELECT process_name FROM Business_processes WHERE process_id = (SELECT next_process_id FROM Business_processes WHERE process_id = 9)
What is the process name for the next process of the process with id 9?
cre_Doc_Workflow
SELECT count(*) FROM Process_outcomes
Show the number of process outcomes.
cre_Doc_Workflow
SELECT process_outcome_code , process_outcome_description FROM Process_outcomes
List the codes and descriptions for all process outcomes.
cre_Doc_Workflow
SELECT process_outcome_description FROM Process_outcomes WHERE process_outcome_code = "working"
What is the description for the process outcome code working?
cre_Doc_Workflow
SELECT count(*) FROM Process_status
Show the number of process status.
cre_Doc_Workflow
SELECT process_status_code , process_status_description FROM Process_status
List the codes and descriptions for all process status.
cre_Doc_Workflow
SELECT process_status_description FROM Process_status WHERE process_status_code = "ct"
What is the description for process status code ct?
cre_Doc_Workflow
SELECT count(*) FROM Staff
How many staff do we have?
cre_Doc_Workflow
SELECT staff_id , staff_details FROM Staff
Show the ids and details for all staff.
cre_Doc_Workflow
SELECT staff_details FROM Staff WHERE staff_id = 100
What are the details for the staff member with id 100.
cre_Doc_Workflow
SELECT count(*) FROM Ref_staff_roles
Show the number of staff roles.
cre_Doc_Workflow
SELECT staff_role_code , staff_role_description FROM Ref_staff_roles
List the codes and descriptions for all staff roles.
cre_Doc_Workflow
SELECT staff_role_description FROM Ref_staff_roles WHERE staff_role_code = "HR"
What is the description for staff role code HR?
cre_Doc_Workflow
SELECT count(DISTINCT document_id) FROM Documents_processes
How many documents have a process?
cre_Doc_Workflow
SELECT DISTINCT process_id FROM Documents_processes
List all process ids with a document.
cre_Doc_Workflow
SELECT document_id FROM Documents EXCEPT SELECT document_id FROM Documents_processes
Show all document ids without a process.
cre_Doc_Workflow
SELECT process_id FROM Business_processes EXCEPT SELECT process_id FROM Documents_processes
List all process ids with no document.
cre_Doc_Workflow
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
What is the process outcome description and process status description for the document with id 0?
cre_Doc_Workflow
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"
What is the process name for the document "Travel to Brazil"?
cre_Doc_Workflow
SELECT process_id , count(*) FROM Documents_processes GROUP BY process_id
Show all process ids and the number of documents in each process.
cre_Doc_Workflow
SELECT count(*) FROM Staff_in_processes WHERE document_id = 0 AND process_id = 9
How many staff are the document with id 0 and process with id 9.
cre_Doc_Workflow
SELECT staff_id , count(*) FROM Staff_in_processes GROUP BY staff_id
Show all staff ids and the number of document processes for each staff.
cre_Doc_Workflow
SELECT staff_role_code , count(*) FROM Staff_in_processes GROUP BY staff_role_code
Show all staff role codes and the number of document processes for each role.
cre_Doc_Workflow
SELECT count(DISTINCT staff_role_code) FROM Staff_in_processes WHERE staff_id = 3
How many different roles does the staff with id 3 have?
advertising_agencies
SELECT count(*) FROM Agencies
How many agencies do we have?
advertising_agencies
SELECT count(*) FROM Agencies
Count the number of agencies.
advertising_agencies
SELECT agency_id , agency_details FROM Agencies
Show all agency ids and details.
advertising_agencies
SELECT agency_id , agency_details FROM Agencies
What are all the agency ids and details?
advertising_agencies
SELECT count(*) FROM Clients
Show the number of clients.
advertising_agencies
SELECT count(*) FROM Clients
How many clients are there?
advertising_agencies
SELECT client_id , client_details FROM Clients
List all client ids and client details.
advertising_agencies
SELECT client_id , client_details FROM Clients
What are all the client ids and details?
advertising_agencies
SELECT agency_id , count(*) FROM Clients GROUP BY agency_id
Show agency ids and the number of clients for each agency.
advertising_agencies
SELECT agency_id , count(*) FROM Clients GROUP BY agency_id
How many clients does each agency have?
advertising_agencies
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
What is the agency id and details with most number of clients?
advertising_agencies
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
Return the agency id and details for the agency with the greatest number of clients.
advertising_agencies
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
Show agency ids and details with at least 2 clients.
advertising_agencies
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
What are the agency ids and details agencies with at least 2 clients?
advertising_agencies
SELECT T2.agency_details FROM Clients AS T1 JOIN Agencies AS T2 ON T1.agency_id = T2.agency_id WHERE T1.client_details = 'Mac'
Show agency details for client with detail 'Mac'.
advertising_agencies
SELECT T2.agency_details FROM Clients AS T1 JOIN Agencies AS T2 ON T1.agency_id = T2.agency_id WHERE T1.client_details = 'Mac'
What are the agency details for clients with the detail Mac?
advertising_agencies
SELECT T1.client_details , T2.agency_details FROM Clients AS T1 JOIN Agencies AS T2 ON T1.agency_id = T2.agency_id
Show details for all clients and the details of their corresponding agents.
advertising_agencies
SELECT T1.client_details , T2.agency_details FROM Clients AS T1 JOIN Agencies AS T2 ON T1.agency_id = T2.agency_id
What are the client details for each client and the corresponding details of their agencies?
advertising_agencies
SELECT sic_code , count(*) FROM Clients GROUP BY sic_code
Show all sic codes and the number of clients with each code.
advertising_agencies
SELECT sic_code , count(*) FROM Clients GROUP BY sic_code
How many clients are there for each sic code?
advertising_agencies
SELECT client_id , client_details FROM Clients WHERE sic_code = "Bad";
Show all client ids and details with sic code "Bad".
advertising_agencies
SELECT client_id , client_details FROM Clients WHERE sic_code = "Bad";
What are the client ideas and details for clients with the sic code Bad?
advertising_agencies
SELECT T1.agency_id , T1.agency_details FROM Agencies AS T1 JOIN Clients AS T2 ON T1.agency_id = T2.agency_id
Show all agency ids and details for agencies with a client.
advertising_agencies
SELECT T1.agency_id , T1.agency_details FROM Agencies AS T1 JOIN Clients AS T2 ON T1.agency_id = T2.agency_id
What are the agency ids and agency details for all agencies who have a client?
advertising_agencies
SELECT agency_id FROM Agencies EXCEPT SELECT agency_id FROM Clients
Show all agency ids without any client.
advertising_agencies
SELECT agency_id FROM Agencies EXCEPT SELECT agency_id FROM Clients
What are ids of agencies that do not have any clients?
advertising_agencies
SELECT count(*) FROM Invoices
How many invoices do we have?
advertising_agencies
SELECT count(*) FROM Invoices
Count the number of invoices.
advertising_agencies
SELECT invoice_id , invoice_status , invoice_details FROM Invoices
Show ids, status codes, and details for all invoices for clients.
advertising_agencies
SELECT invoice_id , invoice_status , invoice_details FROM Invoices
What are the ids, statuses, and details for all invoices?
advertising_agencies
SELECT client_id , count(*) FROM Invoices GROUP BY client_id
Show all client ids and the number of invoices for each client.
advertising_agencies
SELECT client_id , count(*) FROM Invoices GROUP BY client_id
How many invoices are there for each client id?
advertising_agencies
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
List the client id and detail with most number of invoices.
advertising_agencies
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
What are the client id and details for the client with the most invoices?
advertising_agencies
SELECT client_id FROM Invoices GROUP BY client_id HAVING count(*) >= 2
What are client ids for clients with at least 2 invoices.
advertising_agencies
SELECT client_id FROM Invoices GROUP BY client_id HAVING count(*) >= 2
Return the client ids for clients with two or more invoices?
advertising_agencies
SELECT invoice_status , count(*) FROM Invoices GROUP BY invoice_status
Show all invoice status codes and the number of invoices with each status.
advertising_agencies
SELECT invoice_status , count(*) FROM Invoices GROUP BY invoice_status
How many invoices are there for each status code?
advertising_agencies
SELECT invoice_status FROM Invoices GROUP BY invoice_status ORDER BY count(*) DESC LIMIT 1
What is the invoice status code with most number of invoices.
advertising_agencies
SELECT invoice_status FROM Invoices GROUP BY invoice_status ORDER BY count(*) DESC LIMIT 1
Return the invoice status that has the most invoices.
advertising_agencies
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
Show all invoice status codes and details and the corresponding client id and details and agency id and details.
advertising_agencies
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
What are the invoice status, invoice details, and corresponding client ids and details and agency id and details?
advertising_agencies
SELECT meeting_type , other_details FROM meetings
List all meeting type codes and details.