Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: How many accounts do we have? [/INST]

Output: SELECT count(*) FROM Accounts;


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: Count the number of accounts. [/INST]

Output: SELECT count(*) FROM Accounts;


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: Show all account ids and account details. [/INST]

Output: SELECT account_id ,  account_details FROM Accounts;


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: What are the ids and details of all accounts? [/INST]

Output: SELECT account_id ,  account_details FROM Accounts;


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: How many statements do we have? [/INST]

Output: SELECT count(*) FROM Statements;


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: Count the number of statements. [/INST]

Output: SELECT count(*) FROM Statements;


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: List all statement ids and statement details. [/INST]

Output: SELECT STATEMENT_ID ,  statement_details FROM Statements;


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: What are the ids and details of all statements? [/INST]

Output: SELECT STATEMENT_ID ,  statement_details FROM Statements;


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: Show statement id, statement detail, account detail for accounts. [/INST]

Output: SELECT T1.statement_id ,  T2.statement_details ,  T1.account_details FROM Accounts AS T1 JOIN Statements AS T2 ON T1.statement_id  =  T2.statement_id;


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: What are the statement ids, statement details, and account details, for all accounts? [/INST]

Output: SELECT T1.statement_id ,  T2.statement_details ,  T1.account_details FROM Accounts AS T1 JOIN Statements AS T2 ON T1.statement_id  =  T2.statement_id;


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: Show all statement id and the number of accounts for each statement. [/INST]

Output: SELECT STATEMENT_ID ,  count(*) FROM Accounts GROUP BY STATEMENT_ID;


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: What are the different statement ids on accounts, and the number of accounts for each? [/INST]

Output: SELECT STATEMENT_ID ,  count(*) FROM Accounts GROUP BY STATEMENT_ID;


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: Show the statement id and the statement detail for the statement with most number of accounts. [/INST]

Output: SELECT T1.statement_id ,  T2.statement_details FROM Accounts AS T1 JOIN Statements AS T2 ON T1.statement_id  =  T2.statement_id GROUP BY T1.statement_id ORDER BY count(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: What are the statement id and statement detail for the statement that has the most corresponding accounts? [/INST]

Output: SELECT T1.statement_id ,  T2.statement_details FROM Accounts AS T1 JOIN Statements AS T2 ON T1.statement_id  =  T2.statement_id GROUP BY T1.statement_id ORDER BY count(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: Show the number of documents. [/INST]

Output: SELECT count(*) FROM Documents;


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: Count the number of documents. [/INST]

Output: SELECT count(*) FROM Documents;


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: List the document type code, document name, and document description for the document with name 'Noel CV' or name 'King Book'. [/INST]

Output: SELECT document_type_code ,  document_name ,  document_description FROM Documents WHERE document_name  =  'Noel CV' OR document_name  =  'King Book';


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: What are the type come, name, and description of the document that has either the name 'Noel CV' or 'King Book'? [/INST]

Output: SELECT document_type_code ,  document_name ,  document_description FROM Documents WHERE document_name  =  'Noel CV' OR document_name  =  'King Book';


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: Show the ids and names of all documents. [/INST]

Output: SELECT document_id ,  document_name FROM Documents;


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: What are the ids and names for each of the documents? [/INST]

Output: SELECT document_id ,  document_name FROM Documents;


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: Find names and ids of all documents with document type code BK. [/INST]

Output: SELECT document_name ,  document_id FROM Documents WHERE document_type_code  =  "BK";


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names and ids of documents that have the type code BK? [/INST]

Output: SELECT document_name ,  document_id FROM Documents WHERE document_type_code  =  "BK";


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: How many documents are with document type code BK for each product id? [/INST]

Output: SELECT count(*) ,  project_id FROM Documents WHERE document_type_code  =  "BK" GROUP BY project_id;


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: Count the number of documents with the type code BK that correspond to each product id. [/INST]

Output: SELECT count(*) ,  project_id FROM Documents WHERE document_type_code  =  "BK" GROUP BY project_id;


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: Show the document name and the document date for all documents on project with details 'Graph Database project'. [/INST]

Output: 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';


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names and dates for documents corresponding to project that has the details 'Graph Database project'? [/INST]

Output: 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';


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: Show project ids and the number of documents in each project. [/INST]

Output: SELECT project_id ,  count(*) FROM Documents GROUP BY project_id;


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: How many documents correspond with each project id? [/INST]

Output: SELECT project_id ,  count(*) FROM Documents GROUP BY project_id;


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: What is the id of the project with least number of documents? [/INST]

Output: SELECT project_id FROM Documents GROUP BY project_id ORDER BY count(*) ASC LIMIT 1;


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: Return the id of the project that has the fewest corresponding documents. [/INST]

Output: SELECT project_id FROM Documents GROUP BY project_id ORDER BY count(*) ASC LIMIT 1;


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: Show the ids for projects with at least 2 documents. [/INST]

Output: SELECT project_id FROM Documents GROUP BY project_id HAVING count(*)  >=  2;


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: What are project ids of projects that have 2 or more corresponding documents? [/INST]

Output: SELECT project_id FROM Documents GROUP BY project_id HAVING count(*)  >=  2;


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: List document type codes and the number of documents in each code. [/INST]

Output: SELECT document_type_code ,  count(*) FROM Documents GROUP BY document_type_code;


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: How many documents are there of each type? [/INST]

Output: SELECT document_type_code ,  count(*) FROM Documents GROUP BY document_type_code;


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: What is the document type code with most number of documents? [/INST]

Output: SELECT document_type_code FROM Documents GROUP BY document_type_code ORDER BY count(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: Return the code of the document type that is most common. [/INST]

Output: SELECT document_type_code FROM Documents GROUP BY document_type_code ORDER BY count(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: Show the document type code with fewer than 3 documents. [/INST]

Output: SELECT document_type_code FROM Documents GROUP BY document_type_code HAVING count(*)  <  3;


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: What are the codes corresponding to document types for which there are less than 3 documents? [/INST]

Output: SELECT document_type_code FROM Documents GROUP BY document_type_code HAVING count(*)  <  3;


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: Show the statement detail and the corresponding document name for the statement with detail 'Private Project'. [/INST]

Output: 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';


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: What are the details for statements with the details 'Private Project', and what are the names of the corresponding documents? [/INST]

Output: 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';


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: Show all document type codes, document type names, document type descriptions. [/INST]

Output: SELECT document_type_code ,  document_type_name ,  document_type_description FROM Ref_document_types;


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: What are the codes, names, and descriptions of the different document types? [/INST]

Output: SELECT document_type_code ,  document_type_name ,  document_type_description FROM Ref_document_types;


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: What is the document type description for document type named Film? [/INST]

Output: SELECT document_type_description FROM Ref_document_types WHERE document_type_name  =  "Film";


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: Return the description of the document type name 'Film'. [/INST]

Output: SELECT document_type_description FROM Ref_document_types WHERE document_type_name  =  "Film";


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: What is the document type name and the document type description and creation date for all the documents? [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: Return the type name, type description, and date of creation for each document. [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: Show the number of projects. [/INST]

Output: SELECT count(*) FROM Projects;


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: How many projects are there? [/INST]

Output: SELECT count(*) FROM Projects;


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: List ids and details for all projects. [/INST]

Output: SELECT project_id ,  project_details FROM Projects;


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: What are the ids and details for each project? [/INST]

Output: SELECT project_id ,  project_details FROM Projects;


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: What is the project id and detail for the project with at least two documents? [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: Return the ids and details corresponding to projects for which there are more than two documents. [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: What is the project detail for the project with document "King Book"? [/INST]

Output: 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";


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: Give the details of the project with the document name 'King Book'. [/INST]

Output: 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";


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: How many budget types do we have? [/INST]

Output: SELECT count(*) FROM Ref_budget_codes;


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: Count the number of budget codes. [/INST]

Output: SELECT count(*) FROM Ref_budget_codes;


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: List all budget type codes and descriptions. [/INST]

Output: SELECT budget_type_code ,  budget_type_description FROM Ref_budget_codes;


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: What are the type codes and descriptions of each budget type? [/INST]

Output: SELECT budget_type_code ,  budget_type_description FROM Ref_budget_codes;


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: What is the description for the budget type with code ORG? [/INST]

Output: SELECT budget_type_description FROM Ref_budget_codes WHERE budget_type_code  =  "ORG";


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: Return the description of the budget type that has the code ORG. [/INST]

Output: SELECT budget_type_description FROM Ref_budget_codes WHERE budget_type_code  =  "ORG";


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: How many documents have expenses? [/INST]

Output: SELECT count(*) FROM Documents_with_expenses;


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: Count the number of documents with expenses. [/INST]

Output: SELECT count(*) FROM Documents_with_expenses;


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: What are the document ids for the budget type code 'SF'? [/INST]

Output: SELECT document_id FROM Documents_with_expenses WHERE budget_type_code  =  'SF';


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: Give the ids of documents with expenses that have the budget code 'SF'. [/INST]

Output: SELECT document_id FROM Documents_with_expenses WHERE budget_type_code  =  'SF';


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: Show the budget type code and description and the corresponding document id. [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: Return the budget type codes, budget type descriptions and document ids for documents with expenses. [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: Show ids for all documents with budget types described as 'Government'. [/INST]

Output: 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";


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: Give the ids for documents that have the budget description 'Government'. [/INST]

Output: 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";


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: Show budget type codes and the number of documents in each budget type. [/INST]

Output: SELECT budget_type_code ,  count(*) FROM Documents_with_expenses GROUP BY budget_type_code;


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: What are the different budget type codes, and how many documents are there for each? [/INST]

Output: SELECT budget_type_code ,  count(*) FROM Documents_with_expenses GROUP BY budget_type_code;


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: What is the budget type code with most number of documents. [/INST]

Output: SELECT budget_type_code FROM Documents_with_expenses GROUP BY budget_type_code ORDER BY count(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
Ref_Document_Types :
Document_Type_Code [ TEXT ] primary_key
Document_Type_Name [ TEXT ]
Document_Type_Description [ TEXT ]

Ref_Budget_Codes :
Budget_Type_Code [ TEXT ] primary_key
Budget_Type_Description [ TEXT ]

Projects :
Project_ID [ INT ] primary_key
Project_Details [ TEXT ]

Documents :
Document_ID [ INT ] primary_key
Document_Type_Code [ TEXT ] Documents.Document_Type_Code = Ref_Document_Types.Document_Type_Code
Project_ID [ INT ] Documents.Project_ID = Projects.Project_ID
Document_Date [ TEXT ]
Document_Name [ TEXT ]
Document_Description [ TEXT ]
Other_Details [ TEXT ]

Statements :
Statement_ID [ INT ] primary_key Statements.Statement_ID = Documents.Document_ID
Statement_Details [ TEXT ]

Documents_with_Expenses :
Document_ID [ INT ] primary_key Documents_with_Expenses.Document_ID = Documents.Document_ID
Budget_Type_Code [ TEXT ] Documents_with_Expenses.Budget_Type_Code = Ref_Budget_Codes.Budget_Type_Code
Document_Details [ TEXT ]

Accounts :
Account_ID [ INT ] primary_key
Statement_ID [ INT ] Accounts.Statement_ID = Statements.Statement_ID
Account_Details [ TEXT ]

Please write me a SQL statement that answers the following question: Give the budget type code that is most common among documents with expenses. [/INST]

Output: SELECT budget_type_code FROM Documents_with_expenses GROUP BY budget_type_code ORDER BY count(*) DESC LIMIT 1;