SQL for Product Managers
Query Construction
11. Write a query to find the top 5 customers by total revenue.
Tests GROUP BY, SUM, ORDER BY, and LIMIT together, and whether the candidate remembers to sort before limiting.
12. Write a query to find users who signed up but never placed an order.
Tests LEFT JOIN combined with a WHERE ... IS NULL filter on the right-hand table, a very common real-world pattern.
13. How would you calculate month-over-month percentage growth in revenue using SQL?
Tests awareness of window functions (LAG) or self-joins, and the arithmetic of a percentage-change calculation.
14. What's a CTE, and why would you use one instead of a nested subquery?
Look for readability and maintainability as the answer, not just "it's a different syntax."
15. Explain what a window function does differently from GROUP BY.
A strong answer explains that window functions preserve individual rows while still performing the aggregate-style calculation across a defined set of related rows.