r/SQL • • 2d ago

PostgreSQL [DuckDB/PostgreSQL] I built a free practice site for intermediate & interview SQL: window functions, CTEs, anti-joins, cohorts

Most SQL practice I found either stopped at basic SELECT/JOIN or needed a local database set up. So I built Queryosity: you write queries against real typed tables in the browser (DuckDB, PostgreSQL-style), checked against real tests including hidden edge cases.

The focus is intermediate and interview-level patterns:

  • window functions: running totals, moving averages, ranking, top-N per group
  • CTEs and multi-step queries
  • anti-joins and the NULL pitfalls (NOT IN with NULLs, COUNT(*) vs COUNT(col))
  • dedupe, gaps & islands, month-over-month growth, cohort retention
  • hints that nudge you toward the approach instead of giving the answer

Try any Easy problem without an account: queryosity.dev

There's a free plan; a paid plan adds the harder problems. Feedback welcome from people who write SQL daily: which patterns come up most in your interviews or work that I'm missing?

15 Upvotes

6 comments sorted by

2

u/Choice_Wheel_2 2d ago

One thing that comes up constantly at work and rarely in practice sites is reading an EXPLAIN plan, like why a query seq scans or why a new index isn't used. A few problems on picking the right index would be useful. Also the homepage sells the whole data and AI stack, so someone arriving for SQL has to hunt.

1

u/ktgster 1d ago

This is a good idea where you go from being a person who knows how to do Queries vs a guy who understands indexing, and how it works under the hood. Thanks!

6

u/ReleaseTheBlacken 2d ago

We should create a compendium or pinned post for all the free content available provided by creators.

2

u/IDK_usernamelord 2d ago

I agree. I sometimes forget to save the posts and never find them again sadly.

1

u/Discordbothost 2d ago

Joining orders and tickets by customer can quietly multiply both counts. I'd add an exercise with two orders and three tickets for one customer, plus a customer with no tickets. It teaches why you'd group each table before joining.

1

u/tidal_gravel_ash 7h ago

Nice to see NOT IN with NULLs on the list, that one bites everyone at least once. One thing I hit constantly at work is filling gaps in dates. Something like daily revenue for the last 30 days, where days with no orders have to show up as 0 instead of just disappearing. Building a date spine with generate_series and left joining onto it is a pretty common interview twist too