0votes
Write a SQL query from a plain questionPromptLow risk
Describe your tables and ask in English; get correct, readable SQL.
Database: {{database}} Tables and columns: {{schema}} Question: {{question}} Write the SQL query. Rules: - Use CTEs with clear names instead of nested subqueries. - Explain any assumption about what a column means. - Handle NULLs and duplicates explicitly. - Add a comment above each CTE saying what it computes. Then show a 3-row example of the expected output and one way the result could be misleading.

Log in to join the discussion.