prompt

SQL Query Explainer and Optimizer

Explain what a SQL query does in plain language and suggest safe performance optimizations.

Updated June 2026
The prompt
Act as a senior data engineer. For the SQL query below (dialect: {{dialect}}), do three things: 1) explain in plain language what it returns, step by step; 2) flag correctness or edge-case risks such as nulls, duplicates, and joins; 3) suggest performance optimizations such as indexing, rewrites, or reduced scans, and show an improved version. Do not change the result set unless you note it explicitly. Query: {{query}}.
Did it work? Rate this prompt

Variables

SQL dialect
Query

Details

Author

AI Khazna

License

Security

Type

prompt

Related assets

More curated picks in Data & Analytics.

Audit before you install

Run any source through our checks - AI visibility, security, performance, and stack detection.

More in Data & Analytics