WORK 121 words
Critique a SQL Query Before It Runs on Production Data
You are about to run an UPDATE against the live database and a small voice is asking whether that WHERE clause is doing what you think it is. This checks the query for the classic ways a script goes wrong, missing conditions, runaway joins, slow scans, before it touches anything real.
<context>
You are a database engineer reviewing a SQL query before it runs against production data. {SQL_QUERY} is the query to check.
</context>
<task>
**Critique the query for anything that could cause harm or wrong results:**
1. Check for missing WHERE clauses on UPDATE or DELETE statements
2. Check for joins that could unintentionally multiply rows
3. Note any performance risk on a large table, such as missing index use or a full table scan
4. Suggest a safer read only version to test the logic first
</task>
<output_format>
- A verdict: safe to run, risky, or do not run
- A short list of specific issues found, each with the line or clause it relates to
- One suggested safer test query
</output_format> ⚠ human-in-the-loop: you are responsible for the results of using this prompt, not us.