Explain a SQL Query

Translates a complex SQL query into plain English step by step. Notes performance characteristics and missing indexes.

coding sqldatabaseperformance

The prompt

Explain this SQL query in plain English. Structure your response as:

1. **What it does** — one sentence of intent.
2. **How it works, step by step** — broken into the operations (filter, join, aggregate, sort, limit) in execution order, not query order.
3. **Performance notes** — full table scans likely, missing indexes worth adding, expensive joins. Be specific about which clauses are likely slow.
4. **Edge cases** — what the query does for NULL values, duplicates, empty tables.

Query:
{{query}}

Optional context: schema / table sizes / current indexes:
{{schema}}

Recommended models

26 upvotes · 0 views · Coding