c/data › command
0votes

Write a SQL query from a plain questionPromptLow risk

submitted by u/client to c/data · 0 copies

Describe your tables and ask in English; get correct, readable SQL.

Prompt · 3 variables
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.
0 commentsreport
0 comments

Log in to join the discussion.