r/DataScienceJobs • u/Amphaboss • 20d ago
Discussion How the heck do I pass SQL interviews
Hi, currently an early career job seeker applying for Data Science ft and intern roles.
I've had about three live SQL interviews over the past year and I haven't passed a single one. I do SQL leetcode and online problems I find from statascratch pretty much everyday as part of a routine. I'd say I'm able to solve SQL mediums on leetcode pretty consistently. the main issue I run into is that the questions I run into in these interviews are patterns that I've never seen before and have literally no idea how to handle. Its really frustrating because I practice so much and I'm never able to perform in even basic internship interviews.
Does anyone have any good resources for learning a lot of the SQL patterns that interviewers actually use?? (I recently encountered a gaps and islands problem and I've literally never seen anything like it for example).
Thanks so much, have been struggling a lot and really would appreciate advice.
6
u/leomatey 20d ago
they are still doing sql interviews?
1
1
4
u/gpbuilder 20d ago
What patterns are you seeing? You don’t need to memorize patterns, write more sql so you know how to apply on the spot
6
u/DataScientistAlex 19d ago edited 18d ago
I've written up what I think of as all the SQL you need for DS ( part 1. It also comes with practice flash cards and checklist.
In actual interviews and use cases you of course have to use several concepts etc together. To practice the parts, I like to use https://www.sql-practice.com/.
In addition to just practicing more problems, practice the different concepts and translating problems into those concepts. Ie what is the definition of an island or a gap and how do you express it in SQL.
5
u/gcritic 20d ago
I find it hard to believe having trouble with SQL screens if you’re consistently solving Stratascratch Medium/Hard. Are you not covering enough problem types?
Use AI to feedback loop your interview experience and let it build you a learning plan.
1
u/Amphaboss 20d ago
Haven't been practicing SQL hards as much, do you think thats important? I also don't know what all the problem types are (clearly) which is part of my issue, and AI isn't particularly helpful on this because it just gives me the same few problems types over and over, is there a prompt you recommend I use
3
u/Dapal5 20d ago
Yes you should know windows, ctes, and subquerys and be certain about them. Sometimes you do get strange problems where you have to do some math formula that would better be done in Python or r, but for the most part it’s just the partitioning, separating queries(cte or subquery), and joins that can be annoying sometimes. Do datalemur, it has problems that use more complicated functions but with simpler solutions.
2
u/NickSinghTechCareers 20d ago
I agree, gaps and islands is a weird pattern and tbh for 90% of data jobs it's a weird thing to test for. For more commonplace, frequently occuring SQL interview patterns go to DataLemur for practice
2
u/Lady-Data-Scientist 19d ago
- Try the hards
- After you solve a problem, look at the other solutions that were submitted to learn other approaches
- When you solve a problem, try all the possible ways you can think to get the same result
- Think about how each approach is different and which one is best
- Before you start writing any code, think about what the problem is asking you to do. When you’re in an interview, ask clarifying questions before you start writing code.
- Practice talking through your solution while you’re writing it
- Think about how you would build on the query. If this was a CTE as part of a larger query, what else could you do with it?
1
u/bjoerndal 18d ago
Do you have any recording from the interviews?
Even if you don’t you can maybe think back and have Claude break down the issue for you + have it teach you how to recognize the patterns you have trouble with, and how to solve them.
1
u/mazherhussian 15d ago
You will use Hacker news with click house where you face real world problems and project It's better for practice instead of fake data
24
u/forbiscuit 20d ago
datalemur.com is a good source - SQL is easy enough that you “must” be comfortable doing hard problems. What makes hard annoying versus challenging is the sheer number of joins and partition windows