Database: cre_Docs_and_Epenses

Question: What is the budget type code with most number of documents.
SQL: SELECT budget_type_code FROM Documents_with_expenses GROUP BY budget_type_code ORDER BY count(*) DESC LIMIT 1

Question: What are the ids of documents which don't have expense budgets?
SQL: SELECT document_id FROM Documents EXCEPT SELECT document_id FROM Documents_with_expenses

Question: Show ids for all documents in type CV without expense budgets.
SQL: SELECT document_id FROM Documents WHERE document_type_code  =  "CV" EXCEPT SELECT document_id FROM Documents_with_expenses

Question: What are the ids of documents with letter 's' in the name with any expense budgets.
SQL: SELECT T1.document_id FROM Documents AS T1 JOIN Documents_with_expenses AS T2 ON T1.document_id  =  T2.document_id WHERE T1.document_name LIKE '%s%'

Question: How many documents do not have any expense?
SQL: SELECT count(*) FROM Documents WHERE document_id NOT IN ( SELECT document_id FROM Documents_with_expenses )

Question: What are the dates for the documents with both 'GV' type and 'SF' type expenses?
SQL: SELECT T1.document_date FROM Documents AS T1 JOIN Documents_with_Expenses AS T2 ON T1.document_id  =  T2.document_id WHERE T2.budget_type_code  =  'GV' INTERSECT SELECT T1.document_date FROM Documents AS T1 JOIN Documents_with_Expenses AS T2 ON T1.document_id  =  T2.document_id WHERE T2.budget_type_code  =  'SF'