What problem does it solve? Writing correct window function SQL in MariaDB is error-prone: window functions are rejected in WHERE/GROUP BY/HAVING, default frames silently change SUM and LAST_VALUE semantics, and ordered-set functions like PERCENTILE_CONT reject ORDER BY inside OVER. This Skill provides a catalog of MariaDB's window functions plus the common mistakes LLMs make, so generated SQL is correct on the first try. ## Core Features & Use Cases - Function Catalog: Signatures and one-line semantics for ROW_NUMBER, RANK, DENSE_RANK, PERCENT_RANK, CUME_DIST, NTILE, LAG, LEAD, FIRST_VALUE, LAST_VALUE, NTH_VALUE, and MEDIAN, plus OVER, named windows, and ROWS/RANGE frames. - Pitfall Table: Concrete rewrites for frequent errors, such as filtering window results via subqueries, choosing between RANK and DENSE_RANK for top-N-per-group, and fixing LAST_VALUE under the default frame. - Use Case: A user asks for the top 2 orders per customer by amount. The Skill guides producing a CTE with ROW_NUMBER() OVER (PARTITION BY customer_id ORDER BY amount DESC) filtered in the outer query, avoiding the invalid WHERE-clause placement. ## Quick Start Write a MariaDB query that ranks each customer's orders by amount and returns only the two most recent orders per customer using a window function.