nl
stringlengths
22
185
sql
stringlengths
22
608
db_id
stringclasses
40 values
table_schema
stringclasses
305 values
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)
book_press
[{'table_name': 'author', 'table_schema': [{'col_name': 'author id'}, {'col_name': 'name'}, {'col_name': 'age'}, {'col_name': 'gender'}], 'foreign_key_columns': [], 'primary_keys': ['author id']}, {'table_name': 'book', 'table_schema': [{'col_name': 'book id'}, {'col_name': 'title'}, {'col_name': 'book series'}, {'col_...
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
book_press
[{'table_name': 'author', 'table_schema': [{'col_name': 'author id'}, {'col_name': 'name'}, {'col_name': 'age'}, {'col_name': 'gender'}], 'foreign_key_columns': [], 'primary_keys': ['author id']}, {'table_name': 'book', 'table_schema': [{'col_name': 'book id'}, {'col_name': 'title'}, {'col_name': 'book series'}, {'col_...
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
book_press
[{'table_name': 'author', 'table_schema': [{'col_name': 'author id'}, {'col_name': 'name'}, {'col_name': 'age'}, {'col_name': 'gender'}], 'foreign_key_columns': [], 'primary_keys': ['author id']}, {'table_name': 'book', 'table_schema': [{'col_name': 'book id'}, {'col_name': 'title'}, {'col_name': 'book series'}, {'col_...
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
book_press
[{'table_name': 'author', 'table_schema': [{'col_name': 'author id'}, {'col_name': 'name'}, {'col_name': 'age'}, {'col_name': 'gender'}], 'foreign_key_columns': [], 'primary_keys': ['author id']}, {'table_name': 'press', 'table_schema': [{'col_name': 'press id'}, {'col_name': 'name'}, {'col_name': 'month profits billio...
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
book_press
[{'table_name': 'author', 'table_schema': [{'col_name': 'author id'}, {'col_name': 'name'}, {'col_name': 'age'}, {'col_name': 'gender'}], 'foreign_key_columns': [], 'primary_keys': ['author id']}, {'table_name': 'press', 'table_schema': [{'col_name': 'press id'}, {'col_name': 'name'}, {'col_name': 'month profits billio...
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
book_press
[{'table_name': 'press', 'table_schema': [{'col_name': 'press id'}, {'col_name': 'name'}, {'col_name': 'month profits billion'}, {'col_name': 'year profits billion'}], 'foreign_key_columns': [], 'primary_keys': ['press id']}, {'table_name': 'book', 'table_schema': [{'col_name': 'book id'}, {'col_name': 'title'}, {'col_...
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
book_press
[{'table_name': 'press', 'table_schema': [{'col_name': 'press id'}, {'col_name': 'name'}, {'col_name': 'month profits billion'}, {'col_name': 'year profits billion'}], 'foreign_key_columns': [], 'primary_keys': ['press id']}, {'table_name': 'book', 'table_schema': [{'col_name': 'book id'}, {'col_name': 'title'}, {'col_...
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
book_press
[{'table_name': 'press', 'table_schema': [{'col_name': 'press id'}, {'col_name': 'name'}, {'col_name': 'month profits billion'}, {'col_name': 'year profits billion'}], 'foreign_key_columns': [], 'primary_keys': ['press id']}, {'table_name': 'book', 'table_schema': [{'col_name': 'book id'}, {'col_name': 'title'}, {'col_...
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
book_press
[{'table_name': 'press', 'table_schema': [{'col_name': 'press id'}, {'col_name': 'name'}, {'col_name': 'month profits billion'}, {'col_name': 'year profits billion'}], 'foreign_key_columns': [], 'primary_keys': ['press id']}, {'table_name': 'book', 'table_schema': [{'col_name': 'book id'}, {'col_name': 'title'}, {'col_...
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
book_press
[{'table_name': 'author', 'table_schema': [{'col_name': 'author id'}, {'col_name': 'name'}, {'col_name': 'age'}, {'col_name': 'gender'}], 'foreign_key_columns': [], 'primary_keys': ['author id']}, {'table_name': 'book', 'table_schema': [{'col_name': 'book id'}, {'col_name': 'title'}, {'col_name': 'book series'}, {'col_...
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
book_press
[{'table_name': 'author', 'table_schema': [{'col_name': 'author id'}, {'col_name': 'name'}, {'col_name': 'age'}, {'col_name': 'gender'}], 'foreign_key_columns': [], 'primary_keys': ['author id']}, {'table_name': 'book', 'table_schema': [{'col_name': 'book id'}, {'col_name': 'title'}, {'col_name': 'book series'}, {'col_...
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
book_press
[{'table_name': 'author', 'table_schema': [{'col_name': 'author id'}, {'col_name': 'name'}, {'col_name': 'age'}, {'col_name': 'gender'}], 'foreign_key_columns': [], 'primary_keys': ['author id']}, {'table_name': 'book', 'table_schema': [{'col_name': 'book id'}, {'col_name': 'title'}, {'col_name': 'book series'}, {'col_...
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
book_press
[{'table_name': 'author', 'table_schema': [{'col_name': 'author id'}, {'col_name': 'name'}, {'col_name': 'age'}, {'col_name': 'gender'}], 'foreign_key_columns': [], 'primary_keys': ['author id']}, {'table_name': 'book', 'table_schema': [{'col_name': 'book id'}, {'col_name': 'title'}, {'col_name': 'book series'}, {'col_...
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'
book_press
[{'table_name': 'author', 'table_schema': [{'col_name': 'author id'}, {'col_name': 'name'}, {'col_name': 'age'}, {'col_name': 'gender'}], 'foreign_key_columns': [], 'primary_keys': ['author id']}, {'table_name': 'press', 'table_schema': [{'col_name': 'press id'}, {'col_name': 'name'}, {'col_name': 'month profits billio...
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'
book_press
[{'table_name': 'author', 'table_schema': [{'col_name': 'author id'}, {'col_name': 'name'}, {'col_name': 'age'}, {'col_name': 'gender'}], 'foreign_key_columns': [], 'primary_keys': ['author id']}, {'table_name': 'press', 'table_schema': [{'col_name': 'press id'}, {'col_name': 'name'}, {'col_name': 'month profits billio...
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
book_press
[{'table_name': 'press', 'table_schema': [{'col_name': 'press id'}, {'col_name': 'name'}, {'col_name': 'month profits billion'}, {'col_name': 'year profits billion'}], 'foreign_key_columns': [], 'primary_keys': ['press id']}, {'table_name': 'book', 'table_schema': [{'col_name': 'book id'}, {'col_name': 'title'}, {'col_...
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
book_press
[{'table_name': 'press', 'table_schema': [{'col_name': 'press id'}, {'col_name': 'name'}, {'col_name': 'month profits billion'}, {'col_name': 'year profits billion'}], 'foreign_key_columns': [], 'primary_keys': ['press id']}, {'table_name': 'book', 'table_schema': [{'col_name': 'book id'}, {'col_name': 'title'}, {'col_...
How many authors do we have?
SELECT count(*) FROM Authors
cre_Doc_Workflow
[{'table_name': 'authors', 'table_schema': [{'col_name': 'author name'}, {'col_name': 'other details'}], 'foreign_key_columns': [], 'primary_keys': ['author name']}]
Show all author names.
SELECT author_name FROM Authors
cre_Doc_Workflow
[{'table_name': 'authors', 'table_schema': [{'col_name': 'author name'}, {'col_name': 'other details'}], 'foreign_key_columns': [], 'primary_keys': ['author name']}]
Show the names and other details for all authors.
SELECT author_name , other_details FROM Authors
cre_Doc_Workflow
[{'table_name': 'authors', 'table_schema': [{'col_name': 'author name'}, {'col_name': 'other details'}], 'foreign_key_columns': [], 'primary_keys': ['author name']}]
Show the other details for the author Addison Denesik.
SELECT other_details FROM Authors WHERE author_name = "Addison Denesik"
cre_Doc_Workflow
[{'table_name': 'authors', 'table_schema': [{'col_name': 'author name'}, {'col_name': 'other details'}], 'foreign_key_columns': [], 'primary_keys': ['author name']}]
Show the number of documents.
SELECT count(*) FROM Documents
cre_Doc_Workflow
[{'table_name': 'documents', 'table_schema': [{'col_name': 'document id'}, {'col_name': 'author name'}, {'col_name': 'document name'}, {'col_name': 'document description'}, {'col_name': 'other details'}], 'foreign_key_columns': ['author name'], 'primary_keys': ['document id']}]
Who is the author of the document with id 4?
SELECT author_name FROM Documents WHERE document_id = 4
cre_Doc_Workflow
[{'table_name': 'documents', 'table_schema': [{'col_name': 'document id'}, {'col_name': 'author name'}, {'col_name': 'document name'}, {'col_name': 'document description'}, {'col_name': 'other details'}], 'foreign_key_columns': ['author name'], 'primary_keys': ['document id']}]
Who is the author of the document "Travel to Brazil"?
SELECT author_name FROM Documents WHERE document_name = "Travel to Brazil"
cre_Doc_Workflow
[{'table_name': 'documents', 'table_schema': [{'col_name': 'document id'}, {'col_name': 'author name'}, {'col_name': 'document name'}, {'col_name': 'document description'}, {'col_name': 'other details'}], 'foreign_key_columns': ['author name'], 'primary_keys': ['document id']}]
How many documents does has the author Era Kerluke written?
SELECT count(*) FROM Documents WHERE author_name = "Era Kerluke"
cre_Doc_Workflow
[{'table_name': 'documents', 'table_schema': [{'col_name': 'document id'}, {'col_name': 'author name'}, {'col_name': 'document name'}, {'col_name': 'document description'}, {'col_name': 'other details'}], 'foreign_key_columns': ['author name'], 'primary_keys': ['document id']}]
Show the names and descriptions for all documents.
SELECT document_name , document_description FROM Documents
cre_Doc_Workflow
[{'table_name': 'documents', 'table_schema': [{'col_name': 'document id'}, {'col_name': 'author name'}, {'col_name': 'document name'}, {'col_name': 'document description'}, {'col_name': 'other details'}], 'foreign_key_columns': ['author name'], 'primary_keys': ['document id']}]
Show the ids and names for all documents by author Bianka Cummings.
SELECT document_id , document_name FROM Documents WHERE author_name = "Bianka Cummings"
cre_Doc_Workflow
[{'table_name': 'documents', 'table_schema': [{'col_name': 'document id'}, {'col_name': 'author name'}, {'col_name': 'document name'}, {'col_name': 'document description'}, {'col_name': 'other details'}], 'foreign_key_columns': ['author name'], 'primary_keys': ['document id']}]
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"
cre_Doc_Workflow
[{'table_name': 'authors', 'table_schema': [{'col_name': 'author name'}, {'col_name': 'other details'}], 'foreign_key_columns': [], 'primary_keys': ['author name']}, {'table_name': 'documents', 'table_schema': [{'col_name': 'document id'}, {'col_name': 'author name'}, {'col_name': 'document name'}, {'col_name': 'docume...
Show all author names and number of documents corresponding to each.
SELECT author_name , count(*) FROM Documents GROUP BY author_name
cre_Doc_Workflow
[{'table_name': 'documents', 'table_schema': [{'col_name': 'document id'}, {'col_name': 'author name'}, {'col_name': 'document name'}, {'col_name': 'document description'}, {'col_name': 'other details'}], 'foreign_key_columns': ['author name'], 'primary_keys': ['document id']}]
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
cre_Doc_Workflow
[{'table_name': 'documents', 'table_schema': [{'col_name': 'document id'}, {'col_name': 'author name'}, {'col_name': 'document name'}, {'col_name': 'document description'}, {'col_name': 'other details'}], 'foreign_key_columns': ['author name'], 'primary_keys': ['document id']}]
Show the names for authors with at least two documents.
SELECT author_name FROM Documents GROUP BY author_name HAVING count(*) >= 2
cre_Doc_Workflow
[{'table_name': 'documents', 'table_schema': [{'col_name': 'document id'}, {'col_name': 'author name'}, {'col_name': 'document name'}, {'col_name': 'document description'}, {'col_name': 'other details'}], 'foreign_key_columns': ['author name'], 'primary_keys': ['document id']}]
How many business processes do we have?
SELECT count(*) FROM Business_processes
cre_Doc_Workflow
[{'table_name': 'business processes', 'table_schema': [{'col_name': 'process id'}, {'col_name': 'next process id'}, {'col_name': 'process name'}, {'col_name': 'process description'}, {'col_name': 'other details'}], 'foreign_key_columns': [], 'primary_keys': ['process id']}]
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
cre_Doc_Workflow
[{'table_name': 'business processes', 'table_schema': [{'col_name': 'process id'}, {'col_name': 'next process id'}, {'col_name': 'process name'}, {'col_name': 'process description'}, {'col_name': 'other details'}], 'foreign_key_columns': [], 'primary_keys': ['process id']}]
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)
cre_Doc_Workflow
[{'table_name': 'business processes', 'table_schema': [{'col_name': 'process id'}, {'col_name': 'next process id'}, {'col_name': 'process name'}, {'col_name': 'process description'}, {'col_name': 'other details'}], 'foreign_key_columns': [], 'primary_keys': ['process id']}]
Show the number of process outcomes.
SELECT count(*) FROM Process_outcomes
cre_Doc_Workflow
[{'table_name': 'process outcomes', 'table_schema': [{'col_name': 'process outcome code'}, {'col_name': 'process outcome description'}], 'foreign_key_columns': [], 'primary_keys': ['process outcome code']}]
List the codes and descriptions for all process outcomes.
SELECT process_outcome_code , process_outcome_description FROM Process_outcomes
cre_Doc_Workflow
[{'table_name': 'process outcomes', 'table_schema': [{'col_name': 'process outcome code'}, {'col_name': 'process outcome description'}], 'foreign_key_columns': [], 'primary_keys': ['process outcome code']}]
What is the description for the process outcome code working?
SELECT process_outcome_description FROM Process_outcomes WHERE process_outcome_code = "working"
cre_Doc_Workflow
[{'table_name': 'process outcomes', 'table_schema': [{'col_name': 'process outcome code'}, {'col_name': 'process outcome description'}], 'foreign_key_columns': [], 'primary_keys': ['process outcome code']}]
Show the number of process status.
SELECT count(*) FROM Process_status
cre_Doc_Workflow
[{'table_name': 'process status', 'table_schema': [{'col_name': 'process status code'}, {'col_name': 'process status description'}], 'foreign_key_columns': [], 'primary_keys': ['process status code']}]
List the codes and descriptions for all process status.
SELECT process_status_code , process_status_description FROM Process_status
cre_Doc_Workflow
[{'table_name': 'process status', 'table_schema': [{'col_name': 'process status code'}, {'col_name': 'process status description'}], 'foreign_key_columns': [], 'primary_keys': ['process status code']}]
What is the description for process status code ct?
SELECT process_status_description FROM Process_status WHERE process_status_code = "ct"
cre_Doc_Workflow
[{'table_name': 'process status', 'table_schema': [{'col_name': 'process status code'}, {'col_name': 'process status description'}], 'foreign_key_columns': [], 'primary_keys': ['process status code']}]
How many staff do we have?
SELECT count(*) FROM Staff
cre_Doc_Workflow
[{'table_name': 'staff', 'table_schema': [{'col_name': 'staff id'}, {'col_name': 'staff details'}], 'foreign_key_columns': [], 'primary_keys': ['staff id']}]
Show the ids and details for all staff.
SELECT staff_id , staff_details FROM Staff
cre_Doc_Workflow
[{'table_name': 'staff', 'table_schema': [{'col_name': 'staff id'}, {'col_name': 'staff details'}], 'foreign_key_columns': [], 'primary_keys': ['staff id']}]
What are the details for the staff member with id 100.
SELECT staff_details FROM Staff WHERE staff_id = 100
cre_Doc_Workflow
[{'table_name': 'staff', 'table_schema': [{'col_name': 'staff id'}, {'col_name': 'staff details'}], 'foreign_key_columns': [], 'primary_keys': ['staff id']}]
Show the number of staff roles.
SELECT count(*) FROM Ref_staff_roles
cre_Doc_Workflow
[]
List the codes and descriptions for all staff roles.
SELECT staff_role_code , staff_role_description FROM Ref_staff_roles
cre_Doc_Workflow
[]
What is the description for staff role code HR?
SELECT staff_role_description FROM Ref_staff_roles WHERE staff_role_code = "HR"
cre_Doc_Workflow
[]
How many documents have a process?
SELECT count(DISTINCT document_id) FROM Documents_processes
cre_Doc_Workflow
[{'table_name': 'documents processes', 'table_schema': [{'col_name': 'document id'}, {'col_name': 'process id'}, {'col_name': 'process outcome code'}, {'col_name': 'process status code'}], 'foreign_key_columns': ['process status code', 'process outcome code', 'process id', 'document id'], 'primary_keys': ['document id'...
List all process ids with a document.
SELECT DISTINCT process_id FROM Documents_processes
cre_Doc_Workflow
[{'table_name': 'documents processes', 'table_schema': [{'col_name': 'document id'}, {'col_name': 'process id'}, {'col_name': 'process outcome code'}, {'col_name': 'process status code'}], 'foreign_key_columns': ['process status code', 'process outcome code', 'process id', 'document id'], 'primary_keys': ['document id'...
Show all document ids without a process.
SELECT document_id FROM Documents EXCEPT SELECT document_id FROM Documents_processes
cre_Doc_Workflow
[{'table_name': 'documents', 'table_schema': [{'col_name': 'document id'}, {'col_name': 'author name'}, {'col_name': 'document name'}, {'col_name': 'document description'}, {'col_name': 'other details'}], 'foreign_key_columns': ['author name'], 'primary_keys': ['document id']}, {'table_name': 'documents processes', 'ta...
List all process ids with no document.
SELECT process_id FROM Business_processes EXCEPT SELECT process_id FROM Documents_processes
cre_Doc_Workflow
[{'table_name': 'business processes', 'table_schema': [{'col_name': 'process id'}, {'col_name': 'next process id'}, {'col_name': 'process name'}, {'col_name': 'process description'}, {'col_name': 'other details'}], 'foreign_key_columns': [], 'primary_keys': ['process id']}, {'table_name': 'documents processes', 'table_...
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
cre_Doc_Workflow
[{'table_name': 'process outcomes', 'table_schema': [{'col_name': 'process outcome code'}, {'col_name': 'process outcome description'}], 'foreign_key_columns': [], 'primary_keys': ['process outcome code']}, {'table_name': 'process status', 'table_schema': [{'col_name': 'process status code'}, {'col_name': 'process stat...
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"
cre_Doc_Workflow
[{'table_name': 'documents', 'table_schema': [{'col_name': 'document id'}, {'col_name': 'author name'}, {'col_name': 'document name'}, {'col_name': 'document description'}, {'col_name': 'other details'}], 'foreign_key_columns': ['author name'], 'primary_keys': ['document id']}, {'table_name': 'business processes', 'tab...
Show all process ids and the number of documents in each process.
SELECT process_id , count(*) FROM Documents_processes GROUP BY process_id
cre_Doc_Workflow
[{'table_name': 'documents processes', 'table_schema': [{'col_name': 'document id'}, {'col_name': 'process id'}, {'col_name': 'process outcome code'}, {'col_name': 'process status code'}], 'foreign_key_columns': ['process status code', 'process outcome code', 'process id', 'document id'], 'primary_keys': ['document id'...
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
cre_Doc_Workflow
[{'table_name': 'staff in processes', 'table_schema': [{'col_name': 'document id'}, {'col_name': 'process id'}, {'col_name': 'staff id'}, {'col_name': 'staff role code'}, {'col_name': 'date from'}, {'col_name': 'date to'}, {'col_name': 'other details'}], 'foreign_key_columns': ['staff role code', 'document id', 'proces...
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
cre_Doc_Workflow
[{'table_name': 'staff in processes', 'table_schema': [{'col_name': 'document id'}, {'col_name': 'process id'}, {'col_name': 'staff id'}, {'col_name': 'staff role code'}, {'col_name': 'date from'}, {'col_name': 'date to'}, {'col_name': 'other details'}], 'foreign_key_columns': ['staff role code', 'document id', 'proces...
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
cre_Doc_Workflow
[{'table_name': 'staff in processes', 'table_schema': [{'col_name': 'document id'}, {'col_name': 'process id'}, {'col_name': 'staff id'}, {'col_name': 'staff role code'}, {'col_name': 'date from'}, {'col_name': 'date to'}, {'col_name': 'other details'}], 'foreign_key_columns': ['staff role code', 'document id', 'proces...
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
cre_Doc_Workflow
[{'table_name': 'staff in processes', 'table_schema': [{'col_name': 'document id'}, {'col_name': 'process id'}, {'col_name': 'staff id'}, {'col_name': 'staff role code'}, {'col_name': 'date from'}, {'col_name': 'date to'}, {'col_name': 'other details'}], 'foreign_key_columns': ['staff role code', 'document id', 'proces...
How many agencies do we have?
SELECT count(*) FROM Agencies
advertising_agencies
[{'table_name': 'agencies', 'table_schema': [{'col_name': 'agency id'}, {'col_name': 'agency details'}], 'foreign_key_columns': [], 'primary_keys': ['agency id']}]
Count the number of agencies.
SELECT count(*) FROM Agencies
advertising_agencies
[{'table_name': 'agencies', 'table_schema': [{'col_name': 'agency id'}, {'col_name': 'agency details'}], 'foreign_key_columns': [], 'primary_keys': ['agency id']}]
Show all agency ids and details.
SELECT agency_id , agency_details FROM Agencies
advertising_agencies
[{'table_name': 'agencies', 'table_schema': [{'col_name': 'agency id'}, {'col_name': 'agency details'}], 'foreign_key_columns': [], 'primary_keys': ['agency id']}]
What are all the agency ids and details?
SELECT agency_id , agency_details FROM Agencies
advertising_agencies
[{'table_name': 'agencies', 'table_schema': [{'col_name': 'agency id'}, {'col_name': 'agency details'}], 'foreign_key_columns': [], 'primary_keys': ['agency id']}]
Show the number of clients.
SELECT count(*) FROM Clients
advertising_agencies
[{'table_name': 'clients', 'table_schema': [{'col_name': 'client id'}, {'col_name': 'agency id'}, {'col_name': 'sic code'}, {'col_name': 'client details'}], 'foreign_key_columns': ['agency id'], 'primary_keys': ['client id']}]
How many clients are there?
SELECT count(*) FROM Clients
advertising_agencies
[{'table_name': 'clients', 'table_schema': [{'col_name': 'client id'}, {'col_name': 'agency id'}, {'col_name': 'sic code'}, {'col_name': 'client details'}], 'foreign_key_columns': ['agency id'], 'primary_keys': ['client id']}]
List all client ids and client details.
SELECT client_id , client_details FROM Clients
advertising_agencies
[{'table_name': 'clients', 'table_schema': [{'col_name': 'client id'}, {'col_name': 'agency id'}, {'col_name': 'sic code'}, {'col_name': 'client details'}], 'foreign_key_columns': ['agency id'], 'primary_keys': ['client id']}]
What are all the client ids and details?
SELECT client_id , client_details FROM Clients
advertising_agencies
[{'table_name': 'clients', 'table_schema': [{'col_name': 'client id'}, {'col_name': 'agency id'}, {'col_name': 'sic code'}, {'col_name': 'client details'}], 'foreign_key_columns': ['agency id'], 'primary_keys': ['client id']}]
Show agency ids and the number of clients for each agency.
SELECT agency_id , count(*) FROM Clients GROUP BY agency_id
advertising_agencies
[{'table_name': 'clients', 'table_schema': [{'col_name': 'client id'}, {'col_name': 'agency id'}, {'col_name': 'sic code'}, {'col_name': 'client details'}], 'foreign_key_columns': ['agency id'], 'primary_keys': ['client id']}]
How many clients does each agency have?
SELECT agency_id , count(*) FROM Clients GROUP BY agency_id
advertising_agencies
[{'table_name': 'clients', 'table_schema': [{'col_name': 'client id'}, {'col_name': 'agency id'}, {'col_name': 'sic code'}, {'col_name': 'client details'}], 'foreign_key_columns': ['agency id'], 'primary_keys': ['client id']}]
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
advertising_agencies
[{'table_name': 'agencies', 'table_schema': [{'col_name': 'agency id'}, {'col_name': 'agency details'}], 'foreign_key_columns': [], 'primary_keys': ['agency id']}, {'table_name': 'clients', 'table_schema': [{'col_name': 'client id'}, {'col_name': 'agency id'}, {'col_name': 'sic code'}, {'col_name': 'client details'}], ...
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
advertising_agencies
[{'table_name': 'agencies', 'table_schema': [{'col_name': 'agency id'}, {'col_name': 'agency details'}], 'foreign_key_columns': [], 'primary_keys': ['agency id']}, {'table_name': 'clients', 'table_schema': [{'col_name': 'client id'}, {'col_name': 'agency id'}, {'col_name': 'sic code'}, {'col_name': 'client details'}], ...
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
advertising_agencies
[{'table_name': 'agencies', 'table_schema': [{'col_name': 'agency id'}, {'col_name': 'agency details'}], 'foreign_key_columns': [], 'primary_keys': ['agency id']}, {'table_name': 'clients', 'table_schema': [{'col_name': 'client id'}, {'col_name': 'agency id'}, {'col_name': 'sic code'}, {'col_name': 'client details'}], ...
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
advertising_agencies
[{'table_name': 'agencies', 'table_schema': [{'col_name': 'agency id'}, {'col_name': 'agency details'}], 'foreign_key_columns': [], 'primary_keys': ['agency id']}, {'table_name': 'clients', 'table_schema': [{'col_name': 'client id'}, {'col_name': 'agency id'}, {'col_name': 'sic code'}, {'col_name': 'client details'}], ...
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'
advertising_agencies
[{'table_name': 'agencies', 'table_schema': [{'col_name': 'agency id'}, {'col_name': 'agency details'}], 'foreign_key_columns': [], 'primary_keys': ['agency id']}, {'table_name': 'clients', 'table_schema': [{'col_name': 'client id'}, {'col_name': 'agency id'}, {'col_name': 'sic code'}, {'col_name': 'client details'}], ...
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'
advertising_agencies
[{'table_name': 'agencies', 'table_schema': [{'col_name': 'agency id'}, {'col_name': 'agency details'}], 'foreign_key_columns': [], 'primary_keys': ['agency id']}, {'table_name': 'clients', 'table_schema': [{'col_name': 'client id'}, {'col_name': 'agency id'}, {'col_name': 'sic code'}, {'col_name': 'client details'}], ...
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
advertising_agencies
[{'table_name': 'agencies', 'table_schema': [{'col_name': 'agency id'}, {'col_name': 'agency details'}], 'foreign_key_columns': [], 'primary_keys': ['agency id']}, {'table_name': 'clients', 'table_schema': [{'col_name': 'client id'}, {'col_name': 'agency id'}, {'col_name': 'sic code'}, {'col_name': 'client details'}], ...
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
advertising_agencies
[{'table_name': 'agencies', 'table_schema': [{'col_name': 'agency id'}, {'col_name': 'agency details'}], 'foreign_key_columns': [], 'primary_keys': ['agency id']}, {'table_name': 'clients', 'table_schema': [{'col_name': 'client id'}, {'col_name': 'agency id'}, {'col_name': 'sic code'}, {'col_name': 'client details'}], ...
Show all sic codes and the number of clients with each code.
SELECT sic_code , count(*) FROM Clients GROUP BY sic_code
advertising_agencies
[{'table_name': 'clients', 'table_schema': [{'col_name': 'client id'}, {'col_name': 'agency id'}, {'col_name': 'sic code'}, {'col_name': 'client details'}], 'foreign_key_columns': ['agency id'], 'primary_keys': ['client id']}]
How many clients are there for each sic code?
SELECT sic_code , count(*) FROM Clients GROUP BY sic_code
advertising_agencies
[{'table_name': 'clients', 'table_schema': [{'col_name': 'client id'}, {'col_name': 'agency id'}, {'col_name': 'sic code'}, {'col_name': 'client details'}], 'foreign_key_columns': ['agency id'], 'primary_keys': ['client id']}]
Show all client ids and details with sic code "Bad".
SELECT client_id , client_details FROM Clients WHERE sic_code = "Bad";
advertising_agencies
[{'table_name': 'clients', 'table_schema': [{'col_name': 'client id'}, {'col_name': 'agency id'}, {'col_name': 'sic code'}, {'col_name': 'client details'}], 'foreign_key_columns': ['agency id'], 'primary_keys': ['client id']}]
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";
advertising_agencies
[{'table_name': 'clients', 'table_schema': [{'col_name': 'client id'}, {'col_name': 'agency id'}, {'col_name': 'sic code'}, {'col_name': 'client details'}], 'foreign_key_columns': ['agency id'], 'primary_keys': ['client id']}]
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
advertising_agencies
[{'table_name': 'agencies', 'table_schema': [{'col_name': 'agency id'}, {'col_name': 'agency details'}], 'foreign_key_columns': [], 'primary_keys': ['agency id']}, {'table_name': 'clients', 'table_schema': [{'col_name': 'client id'}, {'col_name': 'agency id'}, {'col_name': 'sic code'}, {'col_name': 'client details'}], ...
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
advertising_agencies
[{'table_name': 'agencies', 'table_schema': [{'col_name': 'agency id'}, {'col_name': 'agency details'}], 'foreign_key_columns': [], 'primary_keys': ['agency id']}, {'table_name': 'clients', 'table_schema': [{'col_name': 'client id'}, {'col_name': 'agency id'}, {'col_name': 'sic code'}, {'col_name': 'client details'}], ...
Show all agency ids without any client.
SELECT agency_id FROM Agencies EXCEPT SELECT agency_id FROM Clients
advertising_agencies
[{'table_name': 'agencies', 'table_schema': [{'col_name': 'agency id'}, {'col_name': 'agency details'}], 'foreign_key_columns': [], 'primary_keys': ['agency id']}, {'table_name': 'clients', 'table_schema': [{'col_name': 'client id'}, {'col_name': 'agency id'}, {'col_name': 'sic code'}, {'col_name': 'client details'}], ...
What are ids of agencies that do not have any clients?
SELECT agency_id FROM Agencies EXCEPT SELECT agency_id FROM Clients
advertising_agencies
[{'table_name': 'agencies', 'table_schema': [{'col_name': 'agency id'}, {'col_name': 'agency details'}], 'foreign_key_columns': [], 'primary_keys': ['agency id']}, {'table_name': 'clients', 'table_schema': [{'col_name': 'client id'}, {'col_name': 'agency id'}, {'col_name': 'sic code'}, {'col_name': 'client details'}], ...
How many invoices do we have?
SELECT count(*) FROM Invoices
advertising_agencies
[{'table_name': 'invoices', 'table_schema': [{'col_name': 'invoice id'}, {'col_name': 'client id'}, {'col_name': 'invoice status'}, {'col_name': 'invoice details'}], 'foreign_key_columns': ['client id'], 'primary_keys': ['invoice id']}]
Count the number of invoices.
SELECT count(*) FROM Invoices
advertising_agencies
[{'table_name': 'invoices', 'table_schema': [{'col_name': 'invoice id'}, {'col_name': 'client id'}, {'col_name': 'invoice status'}, {'col_name': 'invoice details'}], 'foreign_key_columns': ['client id'], 'primary_keys': ['invoice id']}]
Show ids, status codes, and details for all invoices for clients.
SELECT invoice_id , invoice_status , invoice_details FROM Invoices
advertising_agencies
[{'table_name': 'invoices', 'table_schema': [{'col_name': 'invoice id'}, {'col_name': 'client id'}, {'col_name': 'invoice status'}, {'col_name': 'invoice details'}], 'foreign_key_columns': ['client id'], 'primary_keys': ['invoice id']}]
What are the ids, statuses, and details for all invoices?
SELECT invoice_id , invoice_status , invoice_details FROM Invoices
advertising_agencies
[{'table_name': 'invoices', 'table_schema': [{'col_name': 'invoice id'}, {'col_name': 'client id'}, {'col_name': 'invoice status'}, {'col_name': 'invoice details'}], 'foreign_key_columns': ['client id'], 'primary_keys': ['invoice id']}]
Show all client ids and the number of invoices for each client.
SELECT client_id , count(*) FROM Invoices GROUP BY client_id
advertising_agencies
[{'table_name': 'invoices', 'table_schema': [{'col_name': 'invoice id'}, {'col_name': 'client id'}, {'col_name': 'invoice status'}, {'col_name': 'invoice details'}], 'foreign_key_columns': ['client id'], 'primary_keys': ['invoice id']}]
How many invoices are there for each client id?
SELECT client_id , count(*) FROM Invoices GROUP BY client_id
advertising_agencies
[{'table_name': 'invoices', 'table_schema': [{'col_name': 'invoice id'}, {'col_name': 'client id'}, {'col_name': 'invoice status'}, {'col_name': 'invoice details'}], 'foreign_key_columns': ['client id'], 'primary_keys': ['invoice id']}]
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
advertising_agencies
[{'table_name': 'clients', 'table_schema': [{'col_name': 'client id'}, {'col_name': 'agency id'}, {'col_name': 'sic code'}, {'col_name': 'client details'}], 'foreign_key_columns': ['agency id'], 'primary_keys': ['client id']}, {'table_name': 'invoices', 'table_schema': [{'col_name': 'invoice id'}, {'col_name': 'client ...
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
advertising_agencies
[{'table_name': 'clients', 'table_schema': [{'col_name': 'client id'}, {'col_name': 'agency id'}, {'col_name': 'sic code'}, {'col_name': 'client details'}], 'foreign_key_columns': ['agency id'], 'primary_keys': ['client id']}, {'table_name': 'invoices', 'table_schema': [{'col_name': 'invoice id'}, {'col_name': 'client ...
What are client ids for clients with at least 2 invoices.
SELECT client_id FROM Invoices GROUP BY client_id HAVING count(*) >= 2
advertising_agencies
[{'table_name': 'invoices', 'table_schema': [{'col_name': 'invoice id'}, {'col_name': 'client id'}, {'col_name': 'invoice status'}, {'col_name': 'invoice details'}], 'foreign_key_columns': ['client id'], 'primary_keys': ['invoice id']}]
Return the client ids for clients with two or more invoices?
SELECT client_id FROM Invoices GROUP BY client_id HAVING count(*) >= 2
advertising_agencies
[{'table_name': 'invoices', 'table_schema': [{'col_name': 'invoice id'}, {'col_name': 'client id'}, {'col_name': 'invoice status'}, {'col_name': 'invoice details'}], 'foreign_key_columns': ['client id'], 'primary_keys': ['invoice id']}]
Show all invoice status codes and the number of invoices with each status.
SELECT invoice_status , count(*) FROM Invoices GROUP BY invoice_status
advertising_agencies
[{'table_name': 'invoices', 'table_schema': [{'col_name': 'invoice id'}, {'col_name': 'client id'}, {'col_name': 'invoice status'}, {'col_name': 'invoice details'}], 'foreign_key_columns': ['client id'], 'primary_keys': ['invoice id']}]
How many invoices are there for each status code?
SELECT invoice_status , count(*) FROM Invoices GROUP BY invoice_status
advertising_agencies
[{'table_name': 'invoices', 'table_schema': [{'col_name': 'invoice id'}, {'col_name': 'client id'}, {'col_name': 'invoice status'}, {'col_name': 'invoice details'}], 'foreign_key_columns': ['client id'], 'primary_keys': ['invoice id']}]
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
advertising_agencies
[{'table_name': 'invoices', 'table_schema': [{'col_name': 'invoice id'}, {'col_name': 'client id'}, {'col_name': 'invoice status'}, {'col_name': 'invoice details'}], 'foreign_key_columns': ['client id'], 'primary_keys': ['invoice id']}]
Return the invoice status that has the most invoices.
SELECT invoice_status FROM Invoices GROUP BY invoice_status ORDER BY count(*) DESC LIMIT 1
advertising_agencies
[{'table_name': 'invoices', 'table_schema': [{'col_name': 'invoice id'}, {'col_name': 'client id'}, {'col_name': 'invoice status'}, {'col_name': 'invoice details'}], 'foreign_key_columns': ['client id'], 'primary_keys': ['invoice id']}]
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
advertising_agencies
[{'table_name': 'agencies', 'table_schema': [{'col_name': 'agency id'}, {'col_name': 'agency details'}], 'foreign_key_columns': [], 'primary_keys': ['agency id']}, {'table_name': 'clients', 'table_schema': [{'col_name': 'client id'}, {'col_name': 'agency id'}, {'col_name': 'sic code'}, {'col_name': 'client details'}], ...
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
advertising_agencies
[{'table_name': 'agencies', 'table_schema': [{'col_name': 'agency id'}, {'col_name': 'agency details'}], 'foreign_key_columns': [], 'primary_keys': ['agency id']}, {'table_name': 'clients', 'table_schema': [{'col_name': 'client id'}, {'col_name': 'agency id'}, {'col_name': 'sic code'}, {'col_name': 'client details'}], ...
List all meeting type codes and details.
SELECT meeting_type , other_details FROM meetings
advertising_agencies
[{'table_name': 'meetings', 'table_schema': [{'col_name': 'meeting id'}, {'col_name': 'client id'}, {'col_name': 'meeting outcome'}, {'col_name': 'meeting type'}, {'col_name': 'billable yn'}, {'col_name': 'start date time'}, {'col_name': 'end date time'}, {'col_name': 'purpose of meeting'}, {'col_name': 'other details'...