brief_instruction
stringlengths
16
224
instruction
stringlengths
687
8.77k
output
stringlengths
18
577
Count the number of documents.
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Count the number of documents.` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM Documents
List the document type code, document name, and document description for the document with name 'Noel CV' or name 'King Book'.
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `List the document type code, document name, and document description for the document with name 'Noel CV' or name 'King Book'.` to a syntactically-correct PostgreSQL query.
SELECT document_type_code , document_name , document_description FROM Documents WHERE document_name = 'Noel CV' OR document_name = 'King Book'
What are the type come, name, and description of the document that has either the name 'Noel CV' or 'King Book'?
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the type come, name, and description of the document that has either the name 'Noel CV' or 'King Book'?` to a syntactically-correct PostgreSQL query.
SELECT document_type_code , document_name , document_description FROM Documents WHERE document_name = 'Noel CV' OR document_name = 'King Book'
Show the ids and names of all documents.
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show the ids and names of all documents.` to a syntactically-correct PostgreSQL query.
SELECT document_id , document_name FROM Documents
What are the ids and names for each of the documents?
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the ids and names for each of the documents?` to a syntactically-correct PostgreSQL query.
SELECT document_id , document_name FROM Documents
Find names and ids of all documents with document type code BK.
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find names and ids of all documents with document type code BK.` to a syntactically-correct PostgreSQL query.
SELECT document_name , document_id FROM Documents WHERE document_type_code = "BK"
What are the names and ids of documents that have the type code BK?
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the names and ids of documents that have the type code BK?` to a syntactically-correct PostgreSQL query.
SELECT document_name , document_id FROM Documents WHERE document_type_code = "BK"
How many documents are with document type code BK for each product id?
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many documents are with document type code BK for each product id?` to a syntactically-correct PostgreSQL query.
SELECT count(*) , project_id FROM Documents WHERE document_type_code = "BK" GROUP BY project_id
Count the number of documents with the type code BK that correspond to each product id.
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Count the number of documents with the type code BK that correspond to each product id.` to a syntactically-correct PostgreSQL query.
SELECT count(*) , project_id FROM Documents WHERE document_type_code = "BK" GROUP BY project_id
Show the document name and the document date for all documents on project with details 'Graph Database project'.
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show the document name and the document date for all documents on project with details 'Graph Database project'.` to a syntactically-correct PostgreSQL query.
SELECT document_name , document_date FROM Documents AS T1 JOIN projects AS T2 ON T1.project_id = T2.project_id WHERE T2.project_details = 'Graph Database project'
What are the names and dates for documents corresponding to project that has the details 'Graph Database project'?
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the names and dates for documents corresponding to project that has the details 'Graph Database project'?` to a syntactically-correct PostgreSQL query.
SELECT document_name , document_date FROM Documents AS T1 JOIN projects AS T2 ON T1.project_id = T2.project_id WHERE T2.project_details = 'Graph Database project'
Show project ids and the number of documents in each project.
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show project ids and the number of documents in each project.` to a syntactically-correct PostgreSQL query.
SELECT project_id , count(*) FROM Documents GROUP BY project_id
How many documents correspond with each project id?
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many documents correspond with each project id?` to a syntactically-correct PostgreSQL query.
SELECT project_id , count(*) FROM Documents GROUP BY project_id
What is the id of the project with least number of documents?
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the id of the project with least number of documents?` to a syntactically-correct PostgreSQL query.
SELECT project_id FROM Documents GROUP BY project_id ORDER BY count(*) ASC LIMIT 1
Return the id of the project that has the fewest corresponding documents.
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Return the id of the project that has the fewest corresponding documents.` to a syntactically-correct PostgreSQL query.
SELECT project_id FROM Documents GROUP BY project_id ORDER BY count(*) ASC LIMIT 1
Show the ids for projects with at least 2 documents.
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show the ids for projects with at least 2 documents.` to a syntactically-correct PostgreSQL query.
SELECT project_id FROM Documents GROUP BY project_id HAVING count(*) >= 2
What are project ids of projects that have 2 or more corresponding documents?
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are project ids of projects that have 2 or more corresponding documents?` to a syntactically-correct PostgreSQL query.
SELECT project_id FROM Documents GROUP BY project_id HAVING count(*) >= 2
List document type codes and the number of documents in each code.
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `List document type codes and the number of documents in each code.` to a syntactically-correct PostgreSQL query.
SELECT document_type_code , count(*) FROM Documents GROUP BY document_type_code
How many documents are there of each type?
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many documents are there of each type?` to a syntactically-correct PostgreSQL query.
SELECT document_type_code , count(*) FROM Documents GROUP BY document_type_code
What is the document type code with most number of documents?
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the document type code with most number of documents?` to a syntactically-correct PostgreSQL query.
SELECT document_type_code FROM Documents GROUP BY document_type_code ORDER BY count(*) DESC LIMIT 1
Return the code of the document type that is most common.
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Return the code of the document type that is most common.` to a syntactically-correct PostgreSQL query.
SELECT document_type_code FROM Documents GROUP BY document_type_code ORDER BY count(*) DESC LIMIT 1
Show the document type code with fewer than 3 documents.
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show the document type code with fewer than 3 documents.` to a syntactically-correct PostgreSQL query.
SELECT document_type_code FROM Documents GROUP BY document_type_code HAVING count(*) < 3
What are the codes corresponding to document types for which there are less than 3 documents?
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the codes corresponding to document types for which there are less than 3 documents?` to a syntactically-correct PostgreSQL query.
SELECT document_type_code FROM Documents GROUP BY document_type_code HAVING count(*) < 3
Show the statement detail and the corresponding document name for the statement with detail 'Private Project'.
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show the statement detail and the corresponding document name for the statement with detail 'Private Project'.` to a syntactically-correct PostgreSQL query.
SELECT T1.statement_details , T2.document_name FROM Statements AS T1 JOIN Documents AS T2 ON T1.statement_id = T2.document_id WHERE T1.statement_details = 'Private Project'
What are the details for statements with the details 'Private Project', and what are the names of the corresponding documents?
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the details for statements with the details 'Private Project', and what are the names of the corresponding documents?` to a syntactically-correct PostgreSQL query.
SELECT T1.statement_details , T2.document_name FROM Statements AS T1 JOIN Documents AS T2 ON T1.statement_id = T2.document_id WHERE T1.statement_details = 'Private Project'
Show all document type codes, document type names, document type descriptions.
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show all document type codes, document type names, document type descriptions.` to a syntactically-correct PostgreSQL query.
SELECT document_type_code , document_type_name , document_type_description FROM Ref_document_types
What are the codes, names, and descriptions of the different document types?
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the codes, names, and descriptions of the different document types?` to a syntactically-correct PostgreSQL query.
SELECT document_type_code , document_type_name , document_type_description FROM Ref_document_types
What is the document type description for document type named Film?
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the document type description for document type named Film?` to a syntactically-correct PostgreSQL query.
SELECT document_type_description FROM Ref_document_types WHERE document_type_name = "Film"
Return the description of the document type name 'Film'.
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Return the description of the document type name 'Film'.` to a syntactically-correct PostgreSQL query.
SELECT document_type_description FROM Ref_document_types WHERE document_type_name = "Film"
What is the document type name and the document type description and creation date for all the documents?
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the document type name and the document type description and creation date for all the documents?` to a syntactically-correct PostgreSQL query.
SELECT T1.document_type_name , T1.document_type_description , T2.Document_date FROM Ref_document_types AS T1 JOIN Documents AS T2 ON T1.document_type_code = T2.document_type_code
Return the type name, type description, and date of creation for each document.
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Return the type name, type description, and date of creation for each document.` to a syntactically-correct PostgreSQL query.
SELECT T1.document_type_name , T1.document_type_description , T2.Document_date FROM Ref_document_types AS T1 JOIN Documents AS T2 ON T1.document_type_code = T2.document_type_code
Show the number of projects.
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show the number of projects.` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM Projects
How many projects are there?
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many projects are there?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM Projects
List ids and details for all projects.
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `List ids and details for all projects.` to a syntactically-correct PostgreSQL query.
SELECT project_id , project_details FROM Projects
What are the ids and details for each project?
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the ids and details for each project?` to a syntactically-correct PostgreSQL query.
SELECT project_id , project_details FROM Projects
What is the project id and detail for the project with at least two documents?
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the project id and detail for the project with at least two documents?` to a syntactically-correct PostgreSQL query.
SELECT T1.project_id , T1.project_details FROM Projects AS T1 JOIN Documents AS T2 ON T1.project_id = T2.project_id GROUP BY T1.project_id HAVING count(*) > 2
Return the ids and details corresponding to projects for which there are more than two documents.
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Return the ids and details corresponding to projects for which there are more than two documents.` to a syntactically-correct PostgreSQL query.
SELECT T1.project_id , T1.project_details FROM Projects AS T1 JOIN Documents AS T2 ON T1.project_id = T2.project_id GROUP BY T1.project_id HAVING count(*) > 2
What is the project detail for the project with document "King Book"?
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the project detail for the project with document "King Book"?` to a syntactically-correct PostgreSQL query.
SELECT T1.project_details FROM Projects AS T1 JOIN Documents AS T2 ON T1.project_id = T2.project_id WHERE T2.document_name = "King Book"
Give the details of the project with the document name 'King Book'.
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Give the details of the project with the document name 'King Book'.` to a syntactically-correct PostgreSQL query.
SELECT T1.project_details FROM Projects AS T1 JOIN Documents AS T2 ON T1.project_id = T2.project_id WHERE T2.document_name = "King Book"
How many budget types do we have?
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many budget types do we have?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM Ref_budget_codes
Count the number of budget codes.
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Count the number of budget codes.` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM Ref_budget_codes
List all budget type codes and descriptions.
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `List all budget type codes and descriptions.` to a syntactically-correct PostgreSQL query.
SELECT budget_type_code , budget_type_description FROM Ref_budget_codes
What are the type codes and descriptions of each budget type?
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the type codes and descriptions of each budget type?` to a syntactically-correct PostgreSQL query.
SELECT budget_type_code , budget_type_description FROM Ref_budget_codes
What is the description for the budget type with code ORG?
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the description for the budget type with code ORG?` to a syntactically-correct PostgreSQL query.
SELECT budget_type_description FROM Ref_budget_codes WHERE budget_type_code = "ORG"
Return the description of the budget type that has the code ORG.
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Return the description of the budget type that has the code ORG.` to a syntactically-correct PostgreSQL query.
SELECT budget_type_description FROM Ref_budget_codes WHERE budget_type_code = "ORG"
How many documents have expenses?
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many documents have expenses?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM Documents_with_expenses
Count the number of documents with expenses.
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Count the number of documents with expenses.` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM Documents_with_expenses
What are the document ids for the budget type code 'SF'?
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the document ids for the budget type code 'SF'?` to a syntactically-correct PostgreSQL query.
SELECT document_id FROM Documents_with_expenses WHERE budget_type_code = 'SF'
Give the ids of documents with expenses that have the budget code 'SF'.
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Give the ids of documents with expenses that have the budget code 'SF'.` to a syntactically-correct PostgreSQL query.
SELECT document_id FROM Documents_with_expenses WHERE budget_type_code = 'SF'
Show the budget type code and description and the corresponding document id.
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show the budget type code and description and the corresponding document id.` to a syntactically-correct PostgreSQL query.
SELECT T2.budget_type_code , T2.budget_type_description , T1.document_id FROM Documents_with_expenses AS T1 JOIN Ref_budget_codes AS T2 ON T1.budget_type_code = T2.budget_type_code
Return the budget type codes, budget type descriptions and document ids for documents with expenses.
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Return the budget type codes, budget type descriptions and document ids for documents with expenses.` to a syntactically-correct PostgreSQL query.
SELECT T2.budget_type_code , T2.budget_type_description , T1.document_id FROM Documents_with_expenses AS T1 JOIN Ref_budget_codes AS T2 ON T1.budget_type_code = T2.budget_type_code
Show ids for all documents with budget types described as 'Government'.
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show ids for all documents with budget types described as 'Government'.` to a syntactically-correct PostgreSQL query.
SELECT T1.document_id FROM Documents_with_expenses AS T1 JOIN Ref_Budget_Codes AS T2 ON T1.Budget_Type_code = T2.Budget_Type_code WHERE T2.budget_type_Description = "Government"
Give the ids for documents that have the budget description 'Government'.
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Give the ids for documents that have the budget description 'Government'.` to a syntactically-correct PostgreSQL query.
SELECT T1.document_id FROM Documents_with_expenses AS T1 JOIN Ref_Budget_Codes AS T2 ON T1.Budget_Type_code = T2.Budget_Type_code WHERE T2.budget_type_Description = "Government"
Show budget type codes and the number of documents in each budget type.
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show budget type codes and the number of documents in each budget type.` to a syntactically-correct PostgreSQL query.
SELECT budget_type_code , count(*) FROM Documents_with_expenses GROUP BY budget_type_code
What are the different budget type codes, and how many documents are there for each?
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the different budget type codes, and how many documents are there for each?` to a syntactically-correct PostgreSQL query.
SELECT budget_type_code , count(*) FROM Documents_with_expenses GROUP BY budget_type_code
What is the budget type code with most number of documents.
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the budget type code with most number of documents.` to a syntactically-correct PostgreSQL query.
SELECT budget_type_code FROM Documents_with_expenses GROUP BY budget_type_code ORDER BY count(*) DESC LIMIT 1
Give the budget type code that is most common among documents with expenses.
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Give the budget type code that is most common among documents with expenses.` to a syntactically-correct PostgreSQL query.
SELECT budget_type_code FROM Documents_with_expenses GROUP BY budget_type_code ORDER BY count(*) DESC LIMIT 1
What are the ids of documents which don't have expense budgets?
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the ids of documents which don't have expense budgets?` to a syntactically-correct PostgreSQL query.
SELECT document_id FROM Documents EXCEPT SELECT document_id FROM Documents_with_expenses
Return the ids of documents that do not have expenses.
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Return the ids of documents that do not have expenses.` to a syntactically-correct PostgreSQL query.
SELECT document_id FROM Documents EXCEPT SELECT document_id FROM Documents_with_expenses
Show ids for all documents in type CV without expense budgets.
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show ids for all documents in type CV without expense budgets.` to a syntactically-correct PostgreSQL query.
SELECT document_id FROM Documents WHERE document_type_code = "CV" EXCEPT SELECT document_id FROM Documents_with_expenses
What are the ids of documents with the type code CV that do not have expenses.
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the ids of documents with the type code CV that do not have expenses.` to a syntactically-correct PostgreSQL query.
SELECT document_id FROM Documents WHERE document_type_code = "CV" EXCEPT SELECT document_id FROM Documents_with_expenses
What are the ids of documents with letter 's' in the name with any expense budgets.
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the ids of documents with letter 's' in the name with any expense budgets.` to a syntactically-correct PostgreSQL query.
SELECT T1.document_id FROM Documents AS T1 JOIN Documents_with_expenses AS T2 ON T1.document_id = T2.document_id WHERE T1.document_name LIKE '%s%'
Give the ids of documents that have expenses and contain the letter s in their names.
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Give the ids of documents that have expenses and contain the letter s in their names.` to a syntactically-correct PostgreSQL query.
SELECT T1.document_id FROM Documents AS T1 JOIN Documents_with_expenses AS T2 ON T1.document_id = T2.document_id WHERE T1.document_name LIKE '%s%'
How many documents do not have any expense?
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many documents do not have any expense?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM Documents WHERE document_id NOT IN ( SELECT document_id FROM Documents_with_expenses )
Count the number of documents that do not have expenses.
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Count the number of documents that do not have expenses.` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM Documents WHERE document_id NOT IN ( SELECT document_id FROM Documents_with_expenses )
What are the dates for the documents with both 'GV' type and 'SF' type expenses?
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the dates for the documents with both 'GV' type and 'SF' type expenses?` to a syntactically-correct PostgreSQL query.
SELECT T1.document_date FROM Documents AS T1 JOIN Documents_with_Expenses AS T2 ON T1.document_id = T2.document_id WHERE T2.budget_type_code = 'GV' INTERSECT SELECT T1.document_date FROM Documents AS T1 JOIN Documents_with_Expenses AS T2 ON T1.document_id = T2.document_id WHERE T2.budget_type_code = 'SF'
Give the dates of creation for documents that have both budget type codes 'GV' and 'SF'.
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Give the dates of creation for documents that have both budget type codes 'GV' and 'SF'.` to a syntactically-correct PostgreSQL query.
SELECT T1.document_date FROM Documents AS T1 JOIN Documents_with_Expenses AS T2 ON T1.document_id = T2.document_id WHERE T2.budget_type_code = 'GV' INTERSECT SELECT T1.document_date FROM Documents AS T1 JOIN Documents_with_Expenses AS T2 ON T1.document_id = T2.document_id WHERE T2.budget_type_code = 'SF'
What are the account details with the largest value or with value having char '5' in it?
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the account details with the largest value or with value having char '5' in it?` to a syntactically-correct PostgreSQL query.
SELECT max(Account_details) FROM Accounts UNION SELECT Account_details FROM Accounts WHERE Account_details LIKE "%5%"
Return the account details with the greatest value, as well as those that include the character 5.
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Return the account details with the greatest value, as well as those that include the character 5.` to a syntactically-correct PostgreSQL query.
SELECT max(Account_details) FROM Accounts UNION SELECT Account_details FROM Accounts WHERE Account_details LIKE "%5%"
Find the total number of scientists.
-- Language PostgreSQL -- Tables: -- Table: scientists columns : [['ssn', 'number'], ['name', 'text']] -- Table: projects columns : [['code', 'text'], ['name', 'text'], ['hours', 'number']] -- Table: assigned to columns : [['scientist', 'number'], ['project', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find the total number of scientists.` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM scientists
How many scientists are there?
-- Language PostgreSQL -- Tables: -- Table: scientists columns : [['ssn', 'number'], ['name', 'text']] -- Table: projects columns : [['code', 'text'], ['name', 'text'], ['hours', 'number']] -- Table: assigned to columns : [['scientist', 'number'], ['project', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many scientists are there?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM scientists
Find the total hours of all projects.
-- Language PostgreSQL -- Tables: -- Table: scientists columns : [['ssn', 'number'], ['name', 'text']] -- Table: projects columns : [['code', 'text'], ['name', 'text'], ['hours', 'number']] -- Table: assigned to columns : [['scientist', 'number'], ['project', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find the total hours of all projects.` to a syntactically-correct PostgreSQL query.
SELECT sum(hours) FROM projects
What is the total number of hours for all projects?
-- Language PostgreSQL -- Tables: -- Table: scientists columns : [['ssn', 'number'], ['name', 'text']] -- Table: projects columns : [['code', 'text'], ['name', 'text'], ['hours', 'number']] -- Table: assigned to columns : [['scientist', 'number'], ['project', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the total number of hours for all projects?` to a syntactically-correct PostgreSQL query.
SELECT sum(hours) FROM projects
How many different scientists are assigned to any project?
-- Language PostgreSQL -- Tables: -- Table: scientists columns : [['ssn', 'number'], ['name', 'text']] -- Table: projects columns : [['code', 'text'], ['name', 'text'], ['hours', 'number']] -- Table: assigned to columns : [['scientist', 'number'], ['project', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many different scientists are assigned to any project?` to a syntactically-correct PostgreSQL query.
SELECT count(DISTINCT scientist) FROM assignedto
Count the number of different scientists assigned to any project.
-- Language PostgreSQL -- Tables: -- Table: scientists columns : [['ssn', 'number'], ['name', 'text']] -- Table: projects columns : [['code', 'text'], ['name', 'text'], ['hours', 'number']] -- Table: assigned to columns : [['scientist', 'number'], ['project', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Count the number of different scientists assigned to any project.` to a syntactically-correct PostgreSQL query.
SELECT count(DISTINCT scientist) FROM assignedto
Find the number of distinct projects.
-- Language PostgreSQL -- Tables: -- Table: scientists columns : [['ssn', 'number'], ['name', 'text']] -- Table: projects columns : [['code', 'text'], ['name', 'text'], ['hours', 'number']] -- Table: assigned to columns : [['scientist', 'number'], ['project', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find the number of distinct projects.` to a syntactically-correct PostgreSQL query.
SELECT count(DISTINCT name) FROM projects
How many different projects are there?
-- Language PostgreSQL -- Tables: -- Table: scientists columns : [['ssn', 'number'], ['name', 'text']] -- Table: projects columns : [['code', 'text'], ['name', 'text'], ['hours', 'number']] -- Table: assigned to columns : [['scientist', 'number'], ['project', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many different projects are there?` to a syntactically-correct PostgreSQL query.
SELECT count(DISTINCT name) FROM projects
Find the average hours of all projects.
-- Language PostgreSQL -- Tables: -- Table: scientists columns : [['ssn', 'number'], ['name', 'text']] -- Table: projects columns : [['code', 'text'], ['name', 'text'], ['hours', 'number']] -- Table: assigned to columns : [['scientist', 'number'], ['project', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find the average hours of all projects.` to a syntactically-correct PostgreSQL query.
SELECT avg(hours) FROM projects
What is the average hours across all projects?
-- Language PostgreSQL -- Tables: -- Table: scientists columns : [['ssn', 'number'], ['name', 'text']] -- Table: projects columns : [['code', 'text'], ['name', 'text'], ['hours', 'number']] -- Table: assigned to columns : [['scientist', 'number'], ['project', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the average hours across all projects?` to a syntactically-correct PostgreSQL query.
SELECT avg(hours) FROM projects
Find the name of project that continues for the longest time.
-- Language PostgreSQL -- Tables: -- Table: scientists columns : [['ssn', 'number'], ['name', 'text']] -- Table: projects columns : [['code', 'text'], ['name', 'text'], ['hours', 'number']] -- Table: assigned to columns : [['scientist', 'number'], ['project', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find the name of project that continues for the longest time.` to a syntactically-correct PostgreSQL query.
SELECT name FROM projects ORDER BY hours DESC LIMIT 1
What is the name of the project with the most hours?
-- Language PostgreSQL -- Tables: -- Table: scientists columns : [['ssn', 'number'], ['name', 'text']] -- Table: projects columns : [['code', 'text'], ['name', 'text'], ['hours', 'number']] -- Table: assigned to columns : [['scientist', 'number'], ['project', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the name of the project with the most hours?` to a syntactically-correct PostgreSQL query.
SELECT name FROM projects ORDER BY hours DESC LIMIT 1
List the name of all projects that are operated longer than the average working hours of all projects.
-- Language PostgreSQL -- Tables: -- Table: scientists columns : [['ssn', 'number'], ['name', 'text']] -- Table: projects columns : [['code', 'text'], ['name', 'text'], ['hours', 'number']] -- Table: assigned to columns : [['scientist', 'number'], ['project', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `List the name of all projects that are operated longer than the average working hours of all projects.` to a syntactically-correct PostgreSQL query.
SELECT name FROM projects WHERE hours > (SELECT avg(hours) FROM projects)
What are the names of projects that have taken longer than the average number of hours for all projects?
-- Language PostgreSQL -- Tables: -- Table: scientists columns : [['ssn', 'number'], ['name', 'text']] -- Table: projects columns : [['code', 'text'], ['name', 'text'], ['hours', 'number']] -- Table: assigned to columns : [['scientist', 'number'], ['project', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the names of projects that have taken longer than the average number of hours for all projects?` to a syntactically-correct PostgreSQL query.
SELECT name FROM projects WHERE hours > (SELECT avg(hours) FROM projects)
Find the name and hours of project that has the most number of scientists.
-- Language PostgreSQL -- Tables: -- Table: scientists columns : [['ssn', 'number'], ['name', 'text']] -- Table: projects columns : [['code', 'text'], ['name', 'text'], ['hours', 'number']] -- Table: assigned to columns : [['scientist', 'number'], ['project', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find the name and hours of project that has the most number of scientists.` to a syntactically-correct PostgreSQL query.
SELECT T1.name , T1.hours FROM projects AS T1 JOIN assignedto AS T2 ON T1.code = T2.project GROUP BY T2.project ORDER BY count(*) DESC LIMIT 1
What is the name and hours for the project which has the most scientists assigned to it?
-- Language PostgreSQL -- Tables: -- Table: scientists columns : [['ssn', 'number'], ['name', 'text']] -- Table: projects columns : [['code', 'text'], ['name', 'text'], ['hours', 'number']] -- Table: assigned to columns : [['scientist', 'number'], ['project', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the name and hours for the project which has the most scientists assigned to it?` to a syntactically-correct PostgreSQL query.
SELECT T1.name , T1.hours FROM projects AS T1 JOIN assignedto AS T2 ON T1.code = T2.project GROUP BY T2.project ORDER BY count(*) DESC LIMIT 1
Find the name of the project for which a scientist whose name contains ‘Smith’ is assigned to.
-- Language PostgreSQL -- Tables: -- Table: scientists columns : [['ssn', 'number'], ['name', 'text']] -- Table: projects columns : [['code', 'text'], ['name', 'text'], ['hours', 'number']] -- Table: assigned to columns : [['scientist', 'number'], ['project', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find the name of the project for which a scientist whose name contains ‘Smith’ is assigned to.` to a syntactically-correct PostgreSQL query.
SELECT T2.name FROM assignedto AS T1 JOIN projects AS T2 ON T1.project = T2.code JOIN scientists AS T3 ON T1.scientist = T3.SSN WHERE T3.name LIKE '%Smith%'
What is the name of the project that has a scientist assigned to it whose name contains 'Smith'?
-- Language PostgreSQL -- Tables: -- Table: scientists columns : [['ssn', 'number'], ['name', 'text']] -- Table: projects columns : [['code', 'text'], ['name', 'text'], ['hours', 'number']] -- Table: assigned to columns : [['scientist', 'number'], ['project', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the name of the project that has a scientist assigned to it whose name contains 'Smith'?` to a syntactically-correct PostgreSQL query.
SELECT T2.name FROM assignedto AS T1 JOIN projects AS T2 ON T1.project = T2.code JOIN scientists AS T3 ON T1.scientist = T3.SSN WHERE T3.name LIKE '%Smith%'
Find the total hours of the projects that scientists named Michael Rogers or Carol Smith are assigned to.
-- Language PostgreSQL -- Tables: -- Table: scientists columns : [['ssn', 'number'], ['name', 'text']] -- Table: projects columns : [['code', 'text'], ['name', 'text'], ['hours', 'number']] -- Table: assigned to columns : [['scientist', 'number'], ['project', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find the total hours of the projects that scientists named Michael Rogers or Carol Smith are assigned to.` to a syntactically-correct PostgreSQL query.
SELECT sum(T2.hours) FROM assignedto AS T1 JOIN projects AS T2 ON T1.project = T2.code JOIN scientists AS T3 ON T1.scientist = T3.SSN WHERE T3.name = 'Michael Rogers' OR T3.name = 'Carol Smith'
What is the sum of hours for projects that scientists with the name Michael Rogers or Carol Smith are assigned to?
-- Language PostgreSQL -- Tables: -- Table: scientists columns : [['ssn', 'number'], ['name', 'text']] -- Table: projects columns : [['code', 'text'], ['name', 'text'], ['hours', 'number']] -- Table: assigned to columns : [['scientist', 'number'], ['project', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the sum of hours for projects that scientists with the name Michael Rogers or Carol Smith are assigned to?` to a syntactically-correct PostgreSQL query.
SELECT sum(T2.hours) FROM assignedto AS T1 JOIN projects AS T2 ON T1.project = T2.code JOIN scientists AS T3 ON T1.scientist = T3.SSN WHERE T3.name = 'Michael Rogers' OR T3.name = 'Carol Smith'
Find the name of projects that require between 100 and 300 hours of work.
-- Language PostgreSQL -- Tables: -- Table: scientists columns : [['ssn', 'number'], ['name', 'text']] -- Table: projects columns : [['code', 'text'], ['name', 'text'], ['hours', 'number']] -- Table: assigned to columns : [['scientist', 'number'], ['project', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find the name of projects that require between 100 and 300 hours of work.` to a syntactically-correct PostgreSQL query.
SELECT name FROM projects WHERE hours BETWEEN 100 AND 300
What are the names of projects that require between 100 and 300 hours?
-- Language PostgreSQL -- Tables: -- Table: scientists columns : [['ssn', 'number'], ['name', 'text']] -- Table: projects columns : [['code', 'text'], ['name', 'text'], ['hours', 'number']] -- Table: assigned to columns : [['scientist', 'number'], ['project', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the names of projects that require between 100 and 300 hours?` to a syntactically-correct PostgreSQL query.
SELECT name FROM projects WHERE hours BETWEEN 100 AND 300
Find the name of the scientist who worked on both a project named 'Matter of Time' and a project named 'A Puzzling Parallax'.
-- Language PostgreSQL -- Tables: -- Table: scientists columns : [['ssn', 'number'], ['name', 'text']] -- Table: projects columns : [['code', 'text'], ['name', 'text'], ['hours', 'number']] -- Table: assigned to columns : [['scientist', 'number'], ['project', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find the name of the scientist who worked on both a project named 'Matter of Time' and a project named 'A Puzzling Parallax'.` to a syntactically-correct PostgreSQL query.
SELECT T3.name FROM assignedto AS T1 JOIN projects AS T2 ON T1.project = T2.code JOIN scientists AS T3 ON T1.scientist = T3.SSN WHERE T2.name = 'Matter of Time' INTERSECT SELECT T3.name FROM assignedto AS T1 JOIN projects AS T2 ON T1.project = T2.code JOIN scientists AS T3 ON T1.scientist = T3.SSN WHERE T2.name = 'A Puzzling Parallax'
What are the names of any scientists who worked on projects named 'Matter of Time' and 'A Puzzling Pattern'?
-- Language PostgreSQL -- Tables: -- Table: scientists columns : [['ssn', 'number'], ['name', 'text']] -- Table: projects columns : [['code', 'text'], ['name', 'text'], ['hours', 'number']] -- Table: assigned to columns : [['scientist', 'number'], ['project', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the names of any scientists who worked on projects named 'Matter of Time' and 'A Puzzling Pattern'?` to a syntactically-correct PostgreSQL query.
SELECT T3.name FROM assignedto AS T1 JOIN projects AS T2 ON T1.project = T2.code JOIN scientists AS T3 ON T1.scientist = T3.SSN WHERE T2.name = 'Matter of Time' INTERSECT SELECT T3.name FROM assignedto AS T1 JOIN projects AS T2 ON T1.project = T2.code JOIN scientists AS T3 ON T1.scientist = T3.SSN WHERE T2.name = 'A Puzzling Parallax'
List the names of all scientists sorted in alphabetical order.
-- Language PostgreSQL -- Tables: -- Table: scientists columns : [['ssn', 'number'], ['name', 'text']] -- Table: projects columns : [['code', 'text'], ['name', 'text'], ['hours', 'number']] -- Table: assigned to columns : [['scientist', 'number'], ['project', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `List the names of all scientists sorted in alphabetical order.` to a syntactically-correct PostgreSQL query.
SELECT name FROM scientists ORDER BY name
What are the names of all the scientists in alphabetical order?
-- Language PostgreSQL -- Tables: -- Table: scientists columns : [['ssn', 'number'], ['name', 'text']] -- Table: projects columns : [['code', 'text'], ['name', 'text'], ['hours', 'number']] -- Table: assigned to columns : [['scientist', 'number'], ['project', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the names of all the scientists in alphabetical order?` to a syntactically-correct PostgreSQL query.
SELECT name FROM scientists ORDER BY name
Find the number of scientists involved for each project name.
-- Language PostgreSQL -- Tables: -- Table: scientists columns : [['ssn', 'number'], ['name', 'text']] -- Table: projects columns : [['code', 'text'], ['name', 'text'], ['hours', 'number']] -- Table: assigned to columns : [['scientist', 'number'], ['project', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find the number of scientists involved for each project name.` to a syntactically-correct PostgreSQL query.
SELECT count(*) , T1.name FROM projects AS T1 JOIN assignedto AS T2 ON T1.code = T2.project GROUP BY T1.name
What are the naems of all the projects, and how many scientists were assigned to each of them?
-- Language PostgreSQL -- Tables: -- Table: scientists columns : [['ssn', 'number'], ['name', 'text']] -- Table: projects columns : [['code', 'text'], ['name', 'text'], ['hours', 'number']] -- Table: assigned to columns : [['scientist', 'number'], ['project', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the naems of all the projects, and how many scientists were assigned to each of them?` to a syntactically-correct PostgreSQL query.
SELECT count(*) , T1.name FROM projects AS T1 JOIN assignedto AS T2 ON T1.code = T2.project GROUP BY T1.name
Find the number of scientists involved for the projects that require more than 300 hours.
-- Language PostgreSQL -- Tables: -- Table: scientists columns : [['ssn', 'number'], ['name', 'text']] -- Table: projects columns : [['code', 'text'], ['name', 'text'], ['hours', 'number']] -- Table: assigned to columns : [['scientist', 'number'], ['project', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find the number of scientists involved for the projects that require more than 300 hours.` to a syntactically-correct PostgreSQL query.
SELECT count(*) , T1.name FROM projects AS T1 JOIN assignedto AS T2 ON T1.code = T2.project WHERE T1.hours > 300 GROUP BY T1.name
What are the names of projects that require more than 300 hours, and how many scientists are assigned to each?
-- Language PostgreSQL -- Tables: -- Table: scientists columns : [['ssn', 'number'], ['name', 'text']] -- Table: projects columns : [['code', 'text'], ['name', 'text'], ['hours', 'number']] -- Table: assigned to columns : [['scientist', 'number'], ['project', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the names of projects that require more than 300 hours, and how many scientists are assigned to each?` to a syntactically-correct PostgreSQL query.
SELECT count(*) , T1.name FROM projects AS T1 JOIN assignedto AS T2 ON T1.code = T2.project WHERE T1.hours > 300 GROUP BY T1.name
Find the number of projects which each scientist is working on and scientist's name.
-- Language PostgreSQL -- Tables: -- Table: scientists columns : [['ssn', 'number'], ['name', 'text']] -- Table: projects columns : [['code', 'text'], ['name', 'text'], ['hours', 'number']] -- Table: assigned to columns : [['scientist', 'number'], ['project', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find the number of projects which each scientist is working on and scientist's name.` to a syntactically-correct PostgreSQL query.
SELECT count(*) , T1.name FROM scientists AS T1 JOIN assignedto AS T2 ON T1.ssn = T2.scientist GROUP BY T1.name