CoreTrail

Practice problem index

Find a problem by technique and difficulty, then compare the worked reasoning.

CorePostgreSQL3 min read
On this page

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.

AGGREGATION · CORE

Largest Olympics

Return every games with the largest number of distinct athletes.

AGGREGATION · INTERMEDIATE

Apple Product Counts

Count users by language without counting every device event.

JOINS · INTERMEDIATE

Spam Posts

Choose the denominator before choosing the query.

EXISTENCE · CORE

Posts with heart reactions

Find matching posts without multiplying them by reaction count.

WINDOWS · INTERMEDIATE

Country rank changes

Compare period-specific rankings with the right population.

WINDOWS · ADVANCED

Top 5% fraud scores

Compare score thresholds and row quotas, especially with ties.

DATES · INTERMEDIATE

Consecutive active days

Find streaks after reducing multiple events to unique dates.

EVENTS · ADVANCED

Sessionize events

Turn inactivity gaps into session boundaries.

DATES · INTERMEDIATE

Later purchases of new products

Compare against all first-day products, not just one row.

JOINS · INTERMEDIATE

Monthly retention

Preserve non-returning users in the denominator.

EVENTS · ADVANCED

Ordered conversion funnel

Require view, cart, and purchase in sequence.

WINDOWS · CORE

Top salaries per department

Decide whether the answer needs rows or distinct salary levels.

MIXED · INTERMEDIATE

Mixed SQL practice

Choose the pattern yourself, then reveal progressive hints.

PERFORMANCE · INTERMEDIATE

Diagnose before optimizing

Six scenarios connecting symptoms, evidence, and next steps.

PERFORMANCE · ADVANCED

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.

References

Type a concept, keyword, or function.