r/SQL • u/Few-Hour-7991 • Aug 13 '26
Discussion Struggling with LeetCode Easy after doing well on HackerRank Easy — should I move to intermediate SQL?
I wanna be straight about this because it’s getting frustrating 😭
I can comfortably solve HackerRank Easy-level SQL questions, but when I try LeetCode Easy, I struggle quite a bit.
I’ve seen people say that HackerRank Easy ≠ LeetCode Easy and that LeetCode can require more problem-solving/thinking even at the Easy level.
So I’m confused about what I should do next.
Should I:
Keep grinding LeetCode Easy until I’m more comfortable?
Or is being able to solve HackerRank Easy well enough to start learning intermediate SQL concepts like subqueries and CTEs, while continuing to practice problems alongside it?
Basically, I don’t want to move on too early and build gaps in my fundamentals, but I also don’t want to unnecessarily stay stuck on Easy problems when I could be learning more advanced SQL.
What would you recommend?
4
u/Alternative_Cake4074 Aug 13 '26
That's interesting, as I think LeetCode Easy is simpler than HackerRank Easy in terms of SQL, so if you can easily solve HackerRank Easy, LeetCode Easy should be a piece of cake.
Having said that, based on your situation, I would still suggest that you do LeetCode Easy first and learn more intermediate concepts. By doing this, you are building a good foundation in test question strategy as well as harder concepts. Once you can swiftly solve LeetCode easy, you can move to LeetCode medium.
19
u/B1zmark Aug 13 '26
Once you've done "easy" on writing SQL, you should start looking at Query Plans and indexes.
I've been doing this for 20 years, and the intermediate+ stuff is <1% of all SQL you write. But badly optimised "easy" SQL is the bane of my existence.
If in an interview you talk about query optimisation and index/statistics then they will immediately stop caring about SQL and look at you like the solution to their slow database problems. Because every company has a "Slow database".
If you really insist on focussing purely on SQL, here are the things that solve 90% of problems:
SELECT/UPDATE/DELETE
JOIN
ROWNUM (aka PARTITION or OVER)
CTE's - WITH [CTE_NAME] AS (QUERY)
CASE
MAX/MIN/SUM/COUNT (GROUP BY)
1
u/mikeblas Aug 13 '26
Why are so many students convinced that there are rigorously prescribed next steps along thier journey? It's as if they believe there is a singular path to success.
1
u/ComicOzzy sqlHippo Aug 13 '26
HackerRank is garbage for SQL. Ignore it entirely and use DataLemur, leetcode, and StrataScratch. Their easy SQL questions are a much better baseline.
1
u/AntLost4161 Aug 13 '26
Easy leetcode problems are easy when you know the logic, but they're gonna be difficult when you're first learning them. When I first learnt SQL, I used the leetcode "SQL 50" problem set and made my first goal to simply get through them all by all means necessary. This meant using AI, looking up solutions, trying to exhaust why my ideas don't work, and a mix of all three. Eventually, you build more intuition and you can solve more.
Transitioning from simple definitions of functions into actual problem solving isn't easy. There's a structure you need to set up in your brain when problem solving that you can't get from reading. How quickly you can build that is pretty much just luck, but working through problems like I stated above is the easiest way to quickly build a rough outline of what things should be. Go back every few days to problems you struggle with and you should see that you remember the solutions
1
u/rbobby Aug 13 '26
I looked at 2 leetcode easy database questions and they were easy. Can you share some examples that gave you trouble?
1
u/Ifuqaround Aug 13 '26 edited Aug 13 '26
CTE's make lots of things stupid easy and are easy to read. It's why newcomers are completely reliant on them and so many SQL users cannot use anything else. I'm not a CTE hater at all, just...that's what I notice after being in this for a while.
If you want me to be honest, as someone actually in this space doing reporting on the daily in Hive and Snowflake, the reporting itself is easy.
The real issue at most jobs is simply becoming familiar enough with the dataset to know something is off when a query is ran. I'm talking like right away you'll notice there needs to be some type of dedupe or whatever.
That's where the experience at a company comes in. I work in healthcare and it took me over a year (multiple, honestly) to really get intimate with our tables and be able to turn questions from the board or quickly grab information for some type of grant funding into a report quickly.
I do not like websites like HackerRank and LeetCode, etc. but I guess someone has to start somewhere.
I think what people who want to dive into SQL should decide pretty early on is if they want to do dev-type work or simply be some kind of analyst. Dev work requires a lot more knowledge. Querying from a few views some 3rd party company created and curated is a lot easier.
-edit- A lot of basic analytical work is not complex at all. Basic selects and joins really.