SQL Window Function Query Review and Practice Scorecard
Review your window function queries for wrong frames, missing partitions and tie handling, then score your understanding from 1 to 5.
The Open buttons send the prompt text as currently shown below to that site only when you click. Fill in the placeholders first.
[VERIFY] is an editorial flag, not a blank to fill. Wherever the prompt shows [VERIFY], check that item against a reliable source before you use it.
Review my SQL queries that use window functions and help me improve. Database engine: [DATABASE_ENGINE]. Table schema: [TABLE_SCHEMA]. My queries: [MY_QUERIES]. What each is supposed to return: [INTENDED_RESULTS]. Results that look wrong, if any: [WRONG_RESULTS]. For each query, give a findings table with columns Query, Issue, Why it gives the wrong or risky result, Fix. Look for: missing PARTITION BY, missing or wrong ORDER BY, default frame surprises (RANGE versus ROWS), ties treated wrongly, NULL ordering, filtering on a window result without a subquery, repeated identical window definitions that could use a named window ([VERIFY] engine support), and unnecessary self joins that a window function replaces. Then score my understanding on these skills from 1 to 5, with evidence from my queries: partitioning, ordering, frames, ranking functions, LAG and LEAD, aggregation over windows, readability. Give a total out of 35 and the two skills to practise next, with two exercises each on my schema. Provide corrected queries in code blocks and the expected result for a tiny invented sample so I can compare. Do not claim to have executed anything. If a query is too ambiguous to judge, ask what the result should be. Recommend read-only SELECT queries only.
Fill in before use
Optional: type your details and the prompt above updates. Nothing is saved or sent.
Replace each bracketed placeholder with your own details, then paste into Any AI or another assistant.