Database: cre_Docs_and_Epenses

Question: Show the statement detail and the corresponding document name for the statement with detail 'Private Project'.
SQL: 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'

Question: Show all document type codes, document type names, document type descriptions.
SQL: SELECT document_type_code ,  document_type_name ,  document_type_description FROM Ref_document_types

Question: What is the document type description for document type named Film?
SQL: SELECT document_type_description FROM Ref_document_types WHERE document_type_name  =  "Film"

Question: What is the document type name and the document type description and creation date for all the documents?
SQL: 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

Question: Show the number of projects.
SQL: SELECT count(*) FROM Projects

Question: List ids and details for all projects.
SQL: SELECT project_id ,  project_details FROM Projects

Question: What is the project id and detail for the project with at least two documents?
SQL: 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

Question: What is the project detail for the project with document "King Book"?
SQL: 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"

Question: How many budget types do we have?
SQL: SELECT count(*) FROM Ref_budget_codes

Question: List all budget type codes and descriptions.
SQL: SELECT budget_type_code ,  budget_type_description FROM Ref_budget_codes

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"

Question: How many documents have expenses?
SQL: SELECT count(*) FROM Documents_with_expenses

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'

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

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"

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