Data & SQL21 categories
Quick safety check on this query
Before running anything expensive, destructive, or going straight into a report.
I have not run this yet. Check three things, in order: does any join multiply rows before the aggregate, does a WHERE condition on an outer-joined table quietly turn it into an inner join, and are the date boundaries inclusive at both ends. Give a verdict: safe to run, run with caveats, or do not run. Query:
Making it yours
- Paste your own material where the prompt asks for it. Everything above that line is instruction, not content.
- Delete any rule that does not apply to you. A shorter prompt that fits beats a thorough one that does not.
- If the answer comes back vague, add a line saying what you do not want. Constraints work better than encouragement.
Correctness checks. Catching the join that duplicates rows, the NULL that drops them, and the GROUP BY that lies.
Related prompts
Check this query before I run itBefore running anything expensive, destructive, or going into a report.Find where this join is duplicating rowsYour totals are suspiciously round multiples of what they should be.Check my aggregation for grouping trapsAny query with GROUP BY that feeds a number someone will act on.Hunt every NULL trap in this queryWhen a count came back lower than expected and nothing looks wrong.Can any of these joins multiply rows?Totals look inflated and you suspect the join before the data.Am I counting the right thing?A count feeds a number someone will act on.
Keep this one
Phrasery saves prompts with a right-click and puts them back the same way. Add this to your own library in one click.
Add to your browser โ free