human
Schema:
Ref_Document_Types (Document_Type_Code, Document_Type_Name, Document_Type_Description)
Ref_Budget_Codes (Budget_Type_Code, Budget_Type_Description)
Projects (Project_ID, Project_Details)
Documents (Document_ID, Document_Type_Code, Project_ID, Document_Date, Document_Name, Document_Description, Other_Details)
Statements (Statement_ID, Statement_Details)
Documents_with_Expenses (Document_ID, Budget_Type_Code, Document_Details)
Accounts (Account_ID, Statement_ID, Account_Details)
Please answer with SQL.
assistant
Sure, I understand.
human
List document type codes and the number of documents in each code.
assistant
SELECT document_type_code , count(*) FROM Documents GROUP BY document_type_code
human
Show the ids and names of all documents.
assistant
SELECT document_id , document_name FROM Documents
human
Show the document name and the document date for all documents on project with details 'Graph Database project'.
assistant
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'
human
Find names and ids of all documents with document type code BK.
assistant
SELECT document_name , document_id FROM Documents WHERE document_type_code = 'BK'
human
Show all document type codes, document type names, document type descriptions.
assistant
SELECT document_type_code , document_type_name , document_type_description FROM Ref_document_types
human
Return the type name, type description, and date of creation for each document.
assistant
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 ;