Home/Blog/SQL

// SQL

DataLemur alternatives for SQL interview practice, compared

Every example on this page was run on 30 October 2026 in the SQL database on this page, which is close to PostgreSQL, and the output under each one is what it printed. How we test these posts.

The main DataLemur alternatives for SQL interview practice are StrataScratch, LeetCode and HackerRank. StrataScratch suits data science, machine learning and AI engineering interviews. LeetCode suits software engineering loops where SQL is one round, with 105 free SQL questions on 30 Oct 2026. HackerRank suits beginners who want short, graded SQL exercises first. Pick by the job you are interviewing for, not by the size of the catalog.

What are the best DataLemur alternatives?

The best DataLemur alternative depends on the role. All three sites below run your SQL and grade the result, as DataLemur does. What differs is what surrounds the SQL: data science extras, algorithm problems, or beginner drills. Each fact in this post was checked on the site’s own page on 30 Oct 2026:

SiteBest forSQL questionsFree to start
StrataScratchData science, ML and AI engineering interviewsPart of 1000+ questionsYes, no credit card
LeetCodeSoftware engineering loops with a SQL round323, of which 105 freeYes, paid tier for the rest
HackerRankBeginners and SQL basics58 in its SQL trackYes, free developer sign up

Which DataLemur alternative is best for data science interviews?

StrataScratch is the closest DataLemur alternative for data science interviews, because it covers the same SQL, Python and statistics rounds and adds the parts DataLemur does not. StrataScratch’s home page (checked 30 Oct 2026) listed 1000+ coding and concept questions for data science, ML and AI engineering interviews, AI mock interviews with feedback, and take-home projects in cloud-hosted Python notebooks.

For a beginner, the same page listed free learning paths for SQL and for Python, each with 6 modules, 36 lessons and 160+ questions, and said “No credit card required”. StrataScratch’s pricing page did not load for us on 30 Oct 2026, so this post states no StrataScratch prices: read them on its own site before you pay. A side-by-side with LeetCode is in StrataScratch vs LeetCode.

Which DataLemur alternative has the most free SQL questions?

LeetCode had the most free SQL questions of the sites we checked. Its Database category held 323 SQL questions on 30 Oct 2026, and 105 of them were free (counted from LeetCode’s problem list, checked 30 Oct 2026):

DifficultyFreePaid only
Easy5558
Medium39105
Hard1155

LeetCode is algorithm-first, so SQL is a small part of a much larger catalog. That suits a software or data engineer whose loop has an algorithm round as well as SQL, since one habit then covers both. A data analyst with no algorithm round gets less from the rest of the site.

What is a good DataLemur alternative for SQL beginners?

HackerRank’s SQL track is a good DataLemur alternative for beginners, because most of its questions are short exercises on one idea each. HackerRank’s SQL page (checked 30 Oct 2026) held 58 challenges, 40 Easy, 16 Medium and 2 Hard, grouped as Basic Select, Advanced Select, Aggregation, Basic Join, Advanced Join and Alternative Queries. HackerRank’s home page offered a free developer sign up the same day.

The questions are less like a data interview than DataLemur’s: more filtering and string handling, fewer business metrics over event tables. Use HackerRank to get fast at the basics, then move on to company-style questions.

What does DataLemur still do better?

DataLemur’s free set is strong for SQL. On 30 Oct 2026, DataLemur’s question list showed 106 questions to a visitor who was not signed in, 54 of them SQL: 21 Easy, 19 Medium and 14 Hard, each with hints and a full written solution. DataLemur’s pricing page listed Premium at $15 a month or $60 a year, adding the rest of its 100+ SQL questions and 70+ statistics, probability and machine learning questions.

If you have not finished DataLemur’s free SQL questions yet, an alternative may not be what you need. What the free tier includes is in Is DataLemur free?.

What kind of SQL question should you be ready for?

Every one of these sites asks for counts under a condition, and a common wrong answer returns the total for every group. Here is an original question of that kind: how many orders in each category were returned? The first attempt wraps a CASE in COUNT:

WITH orders(order_id, category, status) AS (
  VALUES (1, 'Books', 'returned'), (2, 'Books', 'delivered'), (3, 'Books', 'delivered'),
         (4, 'Shoes', 'returned'), (5, 'Shoes', 'returned'), (6, 'Shoes', 'delivered'),
         (7, 'Shoes', 'delivered'), (8, 'Toys', 'delivered'), (9, 'Toys', 'delivered')
)
SELECT category, COUNT(CASE WHEN status = 'returned' THEN 1 ELSE 0 END) AS returned_orders
FROM orders
GROUP BY category
ORDER BY category;

Output

categoryreturned_orders
Books3
Shoes4
Toys2

One book and two pairs of shoes came back, yet the query returns the number of orders in each category. COUNT(expression) counts every row where the expression is not NULL, and ELSE 0 turns each delivered order into a 0, which is not NULL, so every row counts. Add the ones up instead of counting them:

Use SUM(CASE WHEN ... THEN 1 ELSE 0 END) to count rows that meet a condition.

WITH orders(order_id, category, status) AS (
  VALUES (1, 'Books', 'returned'), (2, 'Books', 'delivered'), (3, 'Books', 'delivered'),
         (4, 'Shoes', 'returned'), (5, 'Shoes', 'returned'), (6, 'Shoes', 'delivered'),
         (7, 'Shoes', 'delivered'), (8, 'Toys', 'delivered'), (9, 'Toys', 'delivered')
)
SELECT category, SUM(CASE WHEN status = 'returned' THEN 1 ELSE 0 END) AS returned_orders
FROM orders
GROUP BY category
ORDER BY category;

Output

categoryreturned_orders
Books1
Shoes2
Toys0

A quick check catches the wrong version: when a conditional count equals the group’s total in every row, the condition is not doing anything. The PostgreSQL manual on aggregate functions states that count(expression) counts the rows where the value is not null, and the manual on conditional expressions defines CASE. A related trap, COUNT(*) after a LEFT JOIN, is in Is DataLemur free?.

Where else can you practice SQL interview questions for free?

Prepshotz is free during its beta, with no credit card, and grades each SQL query by running it against a real database, with hints and feedback built around your output. Its catalog is much smaller than DataLemur’s, StrataScratch’s or LeetCode’s, and each account can build 5 goal-built tracks during the beta. The SQL interview practice guide has a study plan, and the comparison page sets DataLemur, LeetCode and Prepshotz side by side.

DataLemur vs StrataScratch and LeetCode SQL alternatives are separate questions with answers of their own. The best site to practice SQL for interviews in general depends on the role more than on the site, and is answered separately too.