LeetCode SQL 50
LeetCode's free study plan of 50 SQL problems, grouped by topic from basic selects and joins through aggregation, sorting and grouping, subqueries and advanced string functions. A focused way to turn SQL knowledge into speed and accuracy, with an online judge and community discussions.
Platform
Web Development
LeetCode
About 1 month
Intermediate
Free
What it is
SQL 50 is a study plan on LeetCode: a curated list of 50 database problems grouped by topic, such as select, basic joins, basic aggregate functions, sorting and grouping, advanced select and joins, subqueries, and advanced string functions, regular expressions and clauses. LeetCode describes it as covering basic to intermediate SQL and suited to about one month of practice (source: LeetCode study plan page, as of 2026-09).
Each problem gives table definitions, sample data and the expected output. You write a query in the browser, submit it, and an online judge runs it against hidden test data. Its database problems let you choose among several SQL dialects, including MySQL, MS SQL Server and PostgreSQL, so you can practise in the one you are learning.
Is it worth your time?
Yes, once you have learned the basics. It is one of the best-known SQL practice sets, the problems are short and realistic, and the hidden tests catch the edge cases that matter: NULLs, ties, duplicates and empty groups. Technical rounds for data and backend roles often use problems in this style. It is practice, not teaching, so use it after a course like SQLBolt or alongside one.
Prerequisites
SELECT, WHERE, joins and GROUP BY. The later sections expect subqueries and window functions.
Free vs paid
The SQL 50 plan is available to free accounts. LeetCode also has an Advanced SQL 50 plan and many other database problems behind its paid Premium subscription; you do not need them to get value from SQL 50.
How to use it well
- Give each problem at least 20 minutes before you look at the discussion.
- When a submission fails, work out which edge case broke it before reading other solutions.
- After solving, read one other solution and note a different approach, such as a window function instead of a subquery.
- Keep your solutions in a Git repository with a comment explaining the approach.
What you can do after it
Solve typical SQL problems with joins, grouping and window functions quickly and correctly, and explain your approach out loud, which is exactly what a live SQL round asks for.
Common questions
Which dialect should I choose? The one you are learning. The logic is the same; function names and limit syntax differ.
Do I need a LeetCode account? Yes, a free account is needed to submit.
Ready to start?
Opens on LeetCode in a new tab.
Stuck on something specific?
Writing only gets you so far. If you want an answer to your situation rather than the general case, book a session and we will work through it together. Sessions are free for approved Sefism members, and a few slots open each week.
Follow along
New writing, resources and project ideas land here first.