Pick a problem
For questions on StrataScratch, LeetCode, and DataLemur, open Find your next SQL problem. The list below contains CoreTrail’s worked examples and drills.
Largest Olympics
Return every games with the largest number of distinct athletes.
Apple Product Counts
Count users by language without counting every device event.
Spam Posts
Choose the denominator before choosing the query.
Posts with heart reactions
Find matching posts without multiplying them by reaction count.
Country rank changes
Compare period-specific rankings with the right population.
Top 5% fraud scores
Compare score thresholds and row quotas, especially with ties.
Consecutive active days
Find streaks after reducing multiple events to unique dates.
Sessionize events
Turn inactivity gaps into session boundaries.
Later purchases of new products
Compare against all first-day products, not just one row.
Monthly retention
Preserve non-returning users in the denominator.
Ordered conversion funnel
Require view, cart, and purchase in sequence.
Top salaries per department
Decide whether the answer needs rows or distinct salary levels.
Mixed SQL practice
Choose the pattern yourself, then reveal progressive hints.
Diagnose before optimizing
Six scenarios connecting symptoms, evidence, and next steps.
Native query-plan labs
Compare actual execution and unchanged results on a larger fixture.
Practice method
Write the expected output grain, identify one edge case, and attempt the query before opening the worked lesson. The linked pages are teaching examples and reconstructions, not claims of exact employer interview questions.
For additional exercises, explore LeetCode SQL 50, DataLemur, and StrataScratch. Check the selected dialect and original question requirements before transferring a solution.