r/learnSQL • u/leogodin217 • Oct 24 '26
Practicing Complex Queries and Large Datasets
A while back, I asked what's missing in this sub. Though not a long discussion, one thing stood out. Working with long, complex queries is something we all run into eventually, but have to learn through experience. I don't think there are a lot of resources for practicing this stuff.
Fabulexa Complex Queries is my first attempt at providing practice. These are intermediate, and possibly advanced, exercises on complex queries within a full data warehouse. Specific exercises have two different tracks.
- Revenge of the 1998 PERL developer: Complex billing logic for a SaaS company written by someone who believed keystrokes should be minimized and readability is an anti-pattern. Can you take the most obtuse, bad-practice-filled query I've ever seen and refactor it? Make it readable.
- Bug hunting in a well-written query. Can you fix the bugs described in tickets? Does it get easier as you learn the data and the data-warehouse structure.
If you are looking for more difficult practice that mimics the real world, this might be for you. If you write, teach or create courses, this might be useful as well. Feel free to grab the data and do your own thing. Hopefully, I'll do a series on this soon.
Finally, suggestions, PRs and comments are very much appreciated.
View all comments
Show parent comment
1
u/RomirBuilds Oct 27 '26
That makes sense, especially for the intermediate audience you're aiming at. Building the comparison could itself be an optional exercise: take the raw diff, identify the affected keys, and produce a report of which fields changed.
I'd keep the raw output as the default and offer a worked comparison query as a separate hint after an attempt. That would preserve the debugging practice while giving stuck learners a way forward. It also makes the tradeoff explicit: learning to build diagnostic tools is part of the exercise.
AI-assisted.