Loadingโฆ
Loadingโฆ
You inherited a 200-line query and need to understand it before changing it.
Explain the SQL below to a competent engineer who has never seen this schema. Structure your answer: 1. **In one sentence**: what question does this query answer? 2. **The grain**: what does one row of the result represent? State it precisely. 3. **Walkthrough**: work outwards from the innermost subquery or first CTE. For each, say what it produces and why the next step needs it. 4. **The joins**: for each, say whether it can multiply rows, and what the join key means in business terms. 5. **Filters**: list every WHERE and HAVING condition and what it excludes. 6. **Suspicious**: anything that looks like it was added to patch a symptom, any filter that silently drops rows, any assumption about the data I should verify. Where you are inferring what a column means from its name, say so. Query:
Writing and reading queries. Drafting SQL from a plain question, making an inherited query legible, and moving it between dialects.
Promptory 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