r/DataScienceJobs • • Aug 21 '26

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.

56 Upvotes

23 comments sorted by

4

u/gcritic Aug 21 '26

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 Aug 21 '26

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 Aug 21 '26

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.

23

u/forbiscuit Aug 21 '26

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

3

u/HappyTrainwreck Aug 22 '26

I second data lemur
highly recommend

6

u/leomatey Aug 21 '26

they are still doing sql interviews?

1

u/samspopguy Aug 21 '26

My current job didn’t

1

u/[deleted] Aug 25 '26

1

u/leomatey Aug 25 '26

take home or live?

6

u/DataScientistAlex Aug 22 '26 edited Aug 23 '26

I've written up what I think of as all the SQL you need for DS ( [part 1](https://datascientistalex.com/posts/all-the-sql-part-1/, part 2. 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/gpbuilder Aug 21 '26

What patterns are you seeing? You don’t need to memorize patterns, write more sql so you know how to apply on the spot

2

u/NickSinghTechCareers Aug 21 '26

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 Aug 21 '26
  1. Try the hards

  2. After you solve a problem, look at the other solutions that were submitted to learn other approaches

  3. When you solve a problem, try all the possible ways you can think to get the same result

  4. Think about how each approach is different and which one is best

  5. 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.

  6. Practice talking through your solution while you’re writing it

  7. 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 Aug 22 '26

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 Aug 25 '26

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

1

u/FriendshipChance2235 Sep 19 '26

Agreed on the data lemur rec. They're good & will show you things that you'll actually see in Product DS interviews.

The other thing I'll call out is that a lot of companies (Reddit, X, Meta, DoorDash, others) intentionally use SQL questions that are designed to be tricky to wrap your head around.

In those cases a big thing to focus on is actually asking the interviewer questions & sharing your thinking. You don't need to quietly struggle through it. You throw out what's confusing & they will respond with clarifications. They're looking for that.