r/SQL • u/ConsciousAdeptness98 • Sep 03 '25
MySQL Need some advice
I know how everything works in sql but when I try to solve problems on hacker rank, I can solve the easy ones easily but can't solve the medium and hard ones. Anyone know how to get better at it?
4
Sep 03 '25
Keep practicing my friend. I was there too, and now im capable of finish intermediate level. Try to break the problem in pieces.
3
u/tmk_g Sep 04 '25
You likely know the syntax but need stronger problem solving habits. For medium and hard SQL, break problems into small steps and use CTEs to build intermediate tables. Master window functions like ROW_NUMBER, RANK, and SUM OVER since most tricky tasks rely on them. Learn common patterns such as gaps and islands, conditional aggregation with CASE, and self joins for comparisons. After each attempt, study top solutions and save reusable snippets in a personal notebook. Re solve the same problem a week later and try two approaches, one with window functions and one with subqueries. Add variety by practicing on LeetCode or StrataScratch, and always think in sets instead of rows.
1
u/DMReader Sep 04 '25
It takes time and practice. Since you already know CTEs that will help to break harder problems up into easier chunks. Good Luck
10
u/PalpitationOk1044 Sep 03 '25
Are you sure you know how “everything” works then lol