sert121/SpiderSQL huggingface dataset:
-- 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.



Question: How many budget types do we have?
SQL: SELECT count(*) FROM Ref_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.



Question: Count the number of budget codes.
SQL: SELECT count(*) FROM Ref_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.



Question: List all budget type codes and descriptions.
SQL: SELECT budget_type_code ,  budget_type_description FROM Ref_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.



Question: What are the type codes and descriptions of each budget type?
SQL: SELECT budget_type_code ,  budget_type_description FROM Ref_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.



Question: What is the description for the budget type with code ORG?
SQL: SELECT budget_type_description FROM Ref_budget_codes WHERE budget_type_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.



Question: Return the description of the budget type that has the code ORG.
SQL: SELECT budget_type_description FROM Ref_budget_codes WHERE budget_type_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.



Question: How many documents have expenses?
SQL: SELECT count(*) FROM 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.



Question: Count the number of documents with expenses.
SQL: SELECT count(*) FROM 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.



Question: What are the document ids for the budget type code 'SF'?
SQL: SELECT document_id FROM Documents_with_expenses WHERE 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.



Question: Give the ids of documents with expenses that have the budget code 'SF'.
SQL: SELECT document_id FROM Documents_with_expenses WHERE 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.



Question: Show the budget type code and description and the corresponding document id.
SQL: 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
-- 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.



Question: Return the budget type codes, budget type descriptions and document ids for documents with expenses.
SQL: 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
-- 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.



Question: Show ids for all documents with budget types described as 'Government'.
SQL: 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"
-- 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.



Question: Give the ids for documents that have the budget description 'Government'.
SQL: 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"
-- 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.



Question: Show budget type codes and the number of documents in each budget type.
SQL: SELECT budget_type_code ,  count(*) FROM Documents_with_expenses GROUP BY budget_type_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.



Question: What are the different budget type codes, and how many documents are there for each?
SQL: SELECT budget_type_code ,  count(*) FROM Documents_with_expenses GROUP BY budget_type_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.



Question: What is the budget type code with most number of documents.
SQL: SELECT budget_type_code FROM Documents_with_expenses GROUP BY budget_type_code ORDER BY count(*) DESC LIMIT 1
-- 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.



Question: Give the budget type code that is most common among documents with expenses.
SQL: SELECT budget_type_code FROM Documents_with_expenses GROUP BY budget_type_code ORDER BY count(*) DESC LIMIT 1
-- 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.



Question: What are the ids of documents which don't have expense budgets?
SQL: SELECT document_id FROM Documents EXCEPT SELECT document_id FROM 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.



Question: Return the ids of documents that do not have expenses.
SQL: SELECT document_id FROM Documents EXCEPT SELECT document_id FROM 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.



Question: Show ids for all documents in type CV without expense budgets.
SQL: SELECT document_id FROM Documents WHERE document_type_code  =  "CV" EXCEPT SELECT document_id FROM 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.



Question: What are the ids of documents with the type code CV that do not have expenses.
SQL: SELECT document_id FROM Documents WHERE document_type_code  =  "CV" EXCEPT SELECT document_id FROM 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.



Question: What are the ids of documents with letter 's' in the name with any expense budgets.
SQL: 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%'
-- 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.



Question: Give the ids of documents that have expenses and contain the letter s in their names.
SQL: 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%'
-- 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.



Question: How many documents do not have any expense?
SQL: SELECT count(*) FROM Documents WHERE document_id NOT IN ( SELECT document_id FROM 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.



Question: Count the number of documents that do not have expenses.
SQL: SELECT count(*) FROM Documents WHERE document_id NOT IN ( SELECT document_id FROM 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.



Question: What are the dates for the documents with both 'GV' type and 'SF' type expenses?
SQL: 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'
-- 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.



Question: Give the dates of creation for documents that have both budget type codes 'GV' and 'SF'.
SQL: 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'
-- 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.



Question: What are the account details with the largest value or with value having char '5' in it?
SQL: SELECT max(Account_details) FROM Accounts UNION SELECT Account_details FROM Accounts WHERE Account_details LIKE "%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.



Question: Return the account details with the greatest value, as well as those that include the character 5.
SQL: SELECT max(Account_details) FROM Accounts UNION SELECT Account_details FROM Accounts WHERE Account_details LIKE "%5%"
-- 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.



Question: Find the total number of scientists.
SQL: SELECT count(*) FROM 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.



Question: How many scientists are there?
SQL: SELECT count(*) FROM 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.



Question: Find the total hours of all projects.
SQL: SELECT sum(hours) FROM 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.



Question: What is the total number of hours for all projects?
SQL: SELECT sum(hours) FROM 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.



Question: How many different scientists are assigned to any project?
SQL: SELECT count(DISTINCT scientist) FROM assignedto