r/SQL • u/Spiritual_Potential4 • 15d ago
Discussion I built a free SQL practice site where an AI writes queries with subtle bugs and you have to find them
Hello. I'm the maker, so take this as a self-promo post, and tell me if it doesn't fit here.
Most SQL practice I found is "write a query from scratch". On the job, a lot of the work is reading someone else's query and noticing it's wrong. Now that "someone" is often an AI. So I built Practisheet: SQL and Excel exercises on one fictional company's data (orders, customers, products, shipments, refunds, targets), where about 1 in 4 exercises gives you a query an AI assistant wrote that looks fine but isn't. A few examples:
- a LEFT JOIN whose WHERE clause quietly turns it into an inner join
- a share-of-total with the wrong denominator
- a RANK with no tie-break, so the "top 3" has 4 rows
- a revenue total that includes refunded orders
It runs in your browser (DuckDB), checks your result set, and when you're wrong it tells you what's off about your attempt without showing the answer.
There are 101 SQL exercises in 14 sections: basics, NULLs, CASE and conditional totals, joins, anti and self joins, set operations, dates, strings, CTEs, window functions, LAG/LEAD and moving averages, and analysis patterns like cohorts and actual vs target. The first 4 are free with no sign-up.
Link in the first comment (or here if links are fine): https://practisheet.com/practice
I'd really like feedback on two things: are the "fix the AI" exercises realistic, and is the difficulty curve right? If something is wrong or annoying, tell me and I'll fix it.
1
u/usernamexxl 15d ago
Lo intentaré probar pero mi nivel de inglés será un pequeño inconveniente. Traducción al español seria un 10. Aún así gracias por la iniciativa
1
u/ontirius 14d ago
the realism is the part that matters. the one that bites most at work isnt in your list though: joining a one-to-many table and then summing a value from the parent, so the total comes out inflated and nothing looks broken.
same family as your wrong denominator one i guess. cant judge the curve without trying it, but window functions are where people usually stall.