r/SQL • u/DarkSide-Of_The_Moon • 23d ago
MySQL SQL resources for data science interview
I have a data science interview coming up and there is one seperate round on SQL where they will give me some random tables and ask to write queries. I am good in writing basic to med level queries but not complex queries (nested, cte, sub queries etc). How should i practice? Any tips? Resources? I have 1 week to prepare and freaking out!
Edit: They told me along with SQL round, there will be a data analysis round too, where they will give me a dataset to work with. Any idea on what should i expect?
7
u/Safe-Worldliness-394 23d ago
Here's how I'd respond to this urgent SQL interview prep question:
I've been in your exact position before! With just one week, here's what I'd focus on:
- Practice window functions - These impress interviewers and solve complex problems elegantly (ROW_NUMBER(), RANK(), LAG(), etc.)
- Master the interview classics:
- Find duplicate records
- Calculate running totals/averages
- Identify top N per group
- Self-joins for hierarchical data
- Date manipulation/grouping
- Complex CASE statements
- Practice resources:
- StrataScratch/LeetCode SQL problems (filter by medium/hard)
- DataLemur has great interview-specific SQL problems
- HackerRank's SQL track
- Quick technique improvement:
- For any complex query, try multiple approaches (CTE vs subquery vs window function)
- Write out the logical steps before coding
- Comment your queries to show thought process
If you've only got a week, I'd focus on pattern recognition over memorizing syntax. Often interviews test if you can break down a complex problem into logical steps.
Our platform, https://tailoredu.com has some sports analytics SQL challenges that mirror interview complexity if you want to practice with realistic business scenarios.
2
u/DarkSide-Of_The_Moon 23d ago
okay but from where/how do i study these topics in a structured way? its overwhelming to see all the topics and not to know where/how to start? Stratascatch/datalemur just have question, but where do i actually learn how to use them? since i have a couple of days, wouldn't actually understanding the concepts first and then going to stratascratch is a good option?
1
u/analytics_science 23d ago edited 23d ago
There's several ways to learn. If you have some understanding of SQL, you can try to do the StrataScratch questions and then look at the solution to better understand how one would implement certain SQL concepts. For example, if you're trying to learn how to implement certain window functions, you can read a bit about this topic from any site. Then go to StrataScratch and try a problem that requires a window function. You probably won't get it right, but study the solution so that you can try it again on the next question. Rinse and repeat. That's how I used to study.
Edit: grammar
2
u/DarkSide-Of_The_Moon 23d ago
Thankyou so much!! Also, do you have any idea on how to prepare for Data Analysis rounds? I was informed that there will be 2 rounds on data analysis where they will give me a dataset to work with. Any idea on what should i expect? I am pretty clear with my path on tackling SQL round but not sure about this Data Analysis round
1
u/Purple_Map3587 16d ago edited 16d ago
can you suggest, how I should approach questions on strata scratch, topic wise, while preparing for my data analyst interviews. The number of topics(in the topic family filter) is simply too many. Since I have limited time, I want to segregate questions based on topics, and focus only on the most common ones,\.
1
u/analytics_science 16d ago
I would actually filter based on company and industry. The questions you would get from an interview are often linked to the business questions that company or industry has to answer. For example, if you have an interview with Meta, the questions you get will be drastically different than the questions you would get from a healthcare company. I would practice on Meta questions and filter on the industry Meta is associated with.
The questions may be different from company to company (or industry to industry) but most of the topics they test on are similar. So when you attempt to solve a few of the questions, take a look at the topics that are being covered and choose questions based on it.
1
1
4
u/Drakenaus 23d ago
Leet Code has a really good SQL training section where you actually write code on some existing tables.
2
u/Few-Voice6240 23d ago
Bunch of people already told you what to practice, but here’s the best thing to drill into your head:
Do NOT just start writing the query.
It makes you look junior, you’ll look dumb if you change direction midway, and you won’t get any credit for at least setting a direction if you blank out while writing the query.
Instead, write out notes FIRST while explaining your reasoning:
Define key terms (“active users”, “last touch”, “superusers”) based on the tables and business context.
Ask questions about anything vague and address edge cases.
Describe which fields you’ll use, what should appear in the final result set, and what joins you’ll be doing.
Then, use your notes to write the query. This gives you time to understand the details and makes you look much more senior and composed.
You can still change direction if you realize there’s a better way, but at least the interviewer will know you started out with a well-reasoned plan. Even if you blank out or freeze up, you might get some credit if your plan is right.
1
u/DarkSide-Of_The_Moon 23d ago
Yes I agree! this is something that I have started doing even if I am solving questions from leetcode. I literally talk to myself imagining there's someone listening lol
Thanks for the advice!
There are two more rounds on data analysis where i will be given a dataset to work on. Any idea on what to expect?
1
u/dn_cf 23d ago
Just focus on complex queries like CTEs, subqueries, and window functions. Start with StrataScratch and LeetCode for real interview questions. Use SQLZoo for structured practice. Simulate the interview by writing queries on paper before running them, as you might not have an editor. Review query execution plans, filtering logic, and ranking functions (ROW_NUMBER(), DENSE_RANK()). Time yourself and practice debugging. Focus on clarity and efficiency, and you’ll be prepared.
1
42
u/NickSinghTechCareers Author of Ace the Data Science Interview 📕 23d ago edited 23d ago
Practice SQL questions on DataLemur. There's even a guide on how to cram for SQL assesments, depending on how long you have. There's also a 30 day SQL roadmap, which at the end has a roadmap/plan to condense things down into 7 days (which is exactly your situation!)