CREATE TABLE Ref_Document_Types (
    Document_Type_Code TEXT PRIMARY KEY,
    Document_Type_Name TEXT,
    Document_Type_Description TEXT
);
CREATE TABLE Ref_Budget_Codes (
    Budget_Type_Code TEXT PRIMARY KEY,
    Budget_Type_Description TEXT
);
CREATE TABLE Projects (
    Project_ID NUMBER PRIMARY KEY,
    Project_Details TEXT
);
CREATE TABLE Documents (
    Document_ID NUMBER PRIMARY KEY,
    Document_Type_Code TEXT,
    Project_ID NUMBER,
    Document_Date TIME,
    Document_Name TEXT,
    Document_Description TEXT,
    Other_Details TEXT,
    FOREIGN KEY ("Project_ID") REFERENCES Projects("Project_ID"),
    FOREIGN KEY ("Document_Type_Code") REFERENCES Ref_Document_Types("Document_Type_Code")
);
CREATE TABLE Statements (
    Statement_ID NUMBER PRIMARY KEY,
    Statement_Details TEXT,
    FOREIGN KEY ("Statement_ID") REFERENCES Documents("Document_ID")
);
CREATE TABLE Documents_with_Expenses (
    Document_ID NUMBER PRIMARY KEY,
    Budget_Type_Code TEXT,
    Document_Details TEXT,
    FOREIGN KEY ("Document_ID") REFERENCES Documents("Document_ID"),
    FOREIGN KEY ("Budget_Type_Code") REFERENCES Ref_Budget_Codes("Budget_Type_Code")
);
CREATE TABLE Accounts (
    Account_ID NUMBER PRIMARY KEY,
    Statement_ID NUMBER,
    Account_Details TEXT,
    FOREIGN KEY ("Statement_ID") REFERENCES Statements("Statement_ID")
);

Question: How many accounts do we have?
SQL: SELECT count(*) FROM Accounts

Question: Count the number of accounts.
SQL: SELECT count(*) FROM Accounts

Question: Show all account ids and account details.
SQL: SELECT account_id ,  account_details FROM Accounts

Question: What are the ids and details of all accounts?
SQL: SELECT account_id ,  account_details FROM Accounts

Question: How many statements do we have?
SQL: SELECT count(*) FROM Statements

Question: Count the number of statements.
SQL: SELECT count(*) FROM Statements

Question: List all statement ids and statement details.
SQL: SELECT STATEMENT_ID ,  statement_details FROM Statements

Question: What are the ids and details of all statements?
SQL: SELECT STATEMENT_ID ,  statement_details FROM Statements

Question: Show statement id, statement detail, account detail for accounts.
SQL: 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

Question: What are the statement ids, statement details, and account details, for all accounts?
SQL: 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

Question: Show all statement id and the number of accounts for each statement.
SQL: SELECT STATEMENT_ID ,  count(*) FROM Accounts GROUP BY STATEMENT_ID

Question: What are the different statement ids on accounts, and the number of accounts for each?
SQL: SELECT STATEMENT_ID ,  count(*) FROM Accounts GROUP BY STATEMENT_ID

Question: Show the statement id and the statement detail for the statement with most number of accounts.
SQL: 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

Question: What are the statement id and statement detail for the statement that has the most corresponding accounts?
SQL: 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

Question: Show the number of documents.
SQL: SELECT count(*) FROM Documents

Question: Count the number of documents.
SQL: SELECT count(*) FROM Documents

Question: List the document type code, document name, and document description for the document with name 'Noel CV' or name 'King Book'.
SQL: SELECT document_type_code ,  document_name ,  document_description FROM Documents WHERE document_name  =  'Noel CV' OR document_name  =  'King Book'

Question: What are the type come, name, and description of the document that has either the name 'Noel CV' or 'King Book'?
SQL: SELECT document_type_code ,  document_name ,  document_description FROM Documents WHERE document_name  =  'Noel CV' OR document_name  =  'King Book'

Question: Show the ids and names of all documents.
SQL: SELECT document_id ,  document_name FROM Documents

Question: What are the ids and names for each of the documents?
SQL: SELECT document_id ,  document_name FROM Documents

Question: Find names and ids of all documents with document type code BK.
SQL: SELECT document_name ,  document_id FROM Documents WHERE document_type_code  =  "BK"

Question: What are the names and ids of documents that have the type code BK?
SQL: SELECT document_name ,  document_id FROM Documents WHERE document_type_code  =  "BK"

Question: How many documents are with document type code BK for each product id?
SQL: SELECT count(*) ,  project_id FROM Documents WHERE document_type_code  =  "BK" GROUP BY project_id

Question: Count the number of documents with the type code BK that correspond to each product id.
SQL: SELECT count(*) ,  project_id FROM Documents WHERE document_type_code  =  "BK" GROUP BY project_id

Question: Show the document name and the document date for all documents on project with details 'Graph Database project'.
SQL: 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'

Question: What are the names and dates for documents corresponding to project that has the details 'Graph Database project'?
SQL: 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'

Question: Show project ids and the number of documents in each project.
SQL: SELECT project_id ,  count(*) FROM Documents GROUP BY project_id

Question: How many documents correspond with each project id?
SQL: SELECT project_id ,  count(*) FROM Documents GROUP BY project_id

Question: What is the id of the project with least number of documents?
SQL: SELECT project_id FROM Documents GROUP BY project_id ORDER BY count(*) ASC LIMIT 1

Question: Return the id of the project that has the fewest corresponding documents.
SQL: SELECT project_id FROM Documents GROUP BY project_id ORDER BY count(*) ASC LIMIT 1

Question: Show the ids for projects with at least 2 documents.
SQL: SELECT project_id FROM Documents GROUP BY project_id HAVING count(*)  >=  2

Question: What are project ids of projects that have 2 or more corresponding documents?
SQL: SELECT project_id FROM Documents GROUP BY project_id HAVING count(*)  >=  2

Question: List document type codes and the number of documents in each code.
SQL: SELECT document_type_code ,  count(*) FROM Documents GROUP BY document_type_code

Question: How many documents are there of each type?
SQL: SELECT document_type_code ,  count(*) FROM Documents GROUP BY document_type_code

Question: What is the document type code with most number of documents?
SQL: SELECT document_type_code FROM Documents GROUP BY document_type_code ORDER BY count(*) DESC LIMIT 1

Question: Return the code of the document type that is most common.
SQL: SELECT document_type_code FROM Documents GROUP BY document_type_code ORDER BY count(*) DESC LIMIT 1

Question: Show the document type code with fewer than 3 documents.
SQL: SELECT document_type_code FROM Documents GROUP BY document_type_code HAVING count(*)  <  3

Question: What are the codes corresponding to document types for which there are less than 3 documents?
SQL: SELECT document_type_code FROM Documents GROUP BY document_type_code HAVING count(*)  <  3