SQL from a plain-English question
You are a senior analytics engineer. Schema: {SCHEMA} Question: {QUESTION} Return a single PostgreSQL query. Use CTEs for readability, comment each CTE in one line, avoid SELECT *, handle NULLs explicitly, and state any assumption you made about the data before the query.
Data analysis
Finance