SQLRep

Your SQL learning path

Each module builds on the one before it. Work through the drills in order, or jump to any you like.

How you'll learn

  1. 1Read a 30-second concept

    Each drill opens with one idea and a tiny example on different data, so the answer isn't handed to you.

  2. 2Write the query yourself

    A real business question and the exact result wanted. You type every query: that's where it sticks.

  3. 3Get corrected instantly

    Wrong rows light up red, and the feedback names the likely mistake, like using OR instead of AND or = NULL.

  4. 4Hints, then the solution

    Stuck? Reveal hints one at a time. After 3 tries the solution unlocks; read it, then type it in yourself.

  5. 5Review until it sticks

    Solved drills come back for review: in a few days if they were easy, tomorrow if you struggled. Each clean solve doubles the gap.

0 / 60 drills solved 0-day streak
Start: Customer directory
  1. Module 1

    The Basics

    0/10

    Filter, sort and summarize a single table: the 80% of SQL you'll write every day.

    1. 1. Customer directorySELECT · ORDER BYUp next
    2. 2. Active Canadian customersWHERE · AND
    3. 3. Customers with a .ca emailLIKE · wildcards
    4. 4. Three biggest ordersORDER BY · LIMIT
    5. 5. Revenue per customerCOUNT · SUM · GROUP BY
    6. 6. Countries with active customersSELECT DISTINCT
    7. 7. First-week shipmentsIN · BETWEEN
    8. 8. Salary bandsCASE WHEN
    9. 9. Filling in missing managersNULL · COALESCE
    10. 10. Weekend loginsEXTRACT · day of week
  2. Module 2

    Intermediate Joins

    0/10

    Combine tables without losing rows, and filter on aggregates with HAVING.

    1. 11. Orders with customer namesINNER JOIN
    2. 12. Every user and their planINNER JOIN vs LEFT JOIN
    3. 13. Users who never subscribedLEFT JOIN · IS NULL
    4. 14. Revenue by countryJOIN + GROUP BY
    5. 15. High-value repeat buyersGROUP BY · HAVING
    6. 16. Plan behind each purchaseThree-table JOIN
    7. 17. Order count, including zeroLEFT JOIN · COUNT(col) vs COUNT(*)
    8. 18. Customers with a big orderIN (subquery) · EXISTS
    9. 19. Purchase date for every userLEFT JOIN · filter in ON vs WHERE
    10. 20. Total touchpoints per userUNION vs UNION ALL
  3. Module 3

    Interview Drills

    0/25

    Window functions, CTEs and the patterns FAANG and fintech interviewers ask about.

    1. 21. Top 3 earners per departmentWindow functions · DENSE_RANK()
    2. 22. Running revenue totalSUM() OVER · running totalsPro
    3. 23. Consecutive-day loginsLAG() · date arithmeticPro
    4. 24. Paid above department averageAVG() OVER · compare to groupPro
    5. 25. Days to first purchaseCTE · MIN · date mathPro
    6. 26. Earning more than their managerSelf-joinPro
    7. 27. Duplicate card chargesGROUP BY · HAVING to find duplicatesPro
    8. 28. Monthly spendto_char · GROUP BY monthPro
    9. 29. Spend by category, one row per accountPivot with FILTER / CASEPro
    10. 30. Share of total spendSUM() OVER () · percent of totalPro
    11. 31. Signup-to-purchase funnelCOUNT(DISTINCT) · funnel stepsPro
    12. 32. Fast convertersJOIN + date differencePro
    13. 33. Month-over-month growthCTE + LAG · growth ratePro
    14. 34. Median salary by departmentPERCENTILE_CONT · ordered-set aggregatesPro
    15. 35. Longest login streakGaps and islandsPro
    16. 36. Refund rate per customerConditional aggregation · FILTERPro
    17. 37. Days until next orderLEAD() · PARTITION BYPro
    18. 38. Each customer's first orderDISTINCT ON · first row per groupPro
    19. 39. Third-highest salary per departmentNth highest · DENSE_RANK() vs ROW_NUMBER()Pro
    20. 40. Largest charge per accountROW_NUMBER() · deterministic tie-breakerPro
    21. 41. Salary quartilesNTILE() · bucketsPro
    22. 42. Active in every monthCOUNT(DISTINCT month) · relational divisionPro
    23. 43. 3-transaction moving averageWindow frames · ROWS vs RANGEPro
    24. 44. First vs latest order valueFIRST_VALUE · LAST_VALUE · frame trapPro
    25. 45. Org chart with recursive CTEWITH RECURSIVE · hierarchiesPro
  4. Module 4

    Analytics Patterns

    0/15

    Retention cohorts, sessionization, gaps and islands, attribution: the real-world analysis senior interviews test.

    1. 46. Order value histogramFLOOR · histogram bucketsPro
    2. 47. Current plan per userDISTINCT ON · latest row per keyPro
    3. 48. Customer share of country revenueSUM() OVER (PARTITION BY) · percent of groupPro
    4. 49. Daily active users, zero days includedgenerate_series · LEFT JOIN · filling date gapsPro
    5. 50. Year-over-year growth by quarterSelf-join on period · YoY %Pro
    6. 51. Plan at time of purchaseAs-of join · JOIN LATERALPro
    7. 52. 7-day moving average revenueRANGE window frame · calendar moving averagePro
    8. 53. DAU/MAU stickinessDistinct user-days · days in month · ratiosPro
    9. 54. Month-1 retention by signup cohortCohorts · date_trunc · LEFT JOINPro
    10. 55. Monthly churn rateAnti-join across months · churnPro
    11. 56. New vs returning usersFirst-seen month · running distinct countPro
    12. 57. First-touch vs last-touch attributionROW_NUMBER both ways · attributionPro
    13. 58. Activity streaks as date rangesGaps and islands · duplicate daysPro
    14. 59. Sessions from raw pageviewsLAG · running SUM · sessionizationPro
    15. 60. Pricing to checkout within an hourFunnel with a time window · range joinPro

Today's free interview drill

One Pro drill is free for everyone each day. Open today's, or get it by email:

One SQL question a day, nothing else. Unsubscribe with one click in any email.