SQL Roadmap for Analytical Roles Interviews

Jack Smith
6 min readJan 8, 2023

--

In this post, I provide a roadmap for learning SQL. After spending countless years grudgingly combing through many SQL learning resources I’m excited to share with you what I think is the best way to learn SQL. I should also note I learned SQL in the context of landing a data analytics supporting business type role (marketing analytics/sales strategy), so if you’re interested in getting into that field this post will be especially helpful!

This post will focus on: crushing your SQL interviews. For one, landing a job is important and a good reason to learn a new skill. Secondly, I actually think SQL interviews is where your SQL skills are truly tested, so that’s what I’m going to focus on.

Personally, I’ve used many many SQL resources when trying to learn SQL including online sites, YouTube tutorials, books, and even attended SQL classes. I curated a learning plan for you with the best of the best resources for learning SQL quickly and will cost you less than $25.

I summarized all my recommendations in a learning roadmap slide.

My first recommendation is the book SQL in 10 minutes by Ben Forta.

The book is available on amazon. It costs $24. The book packs a ton of value in a very concise format and is absolutely worth the price. You can carry the small book around with you — read it on your commute (or in a hammock). It’s a super quick read and has a lot of great content and will provide you with an excellent SQL foundation.

SQL in 10 minutes was the first SQL book I owned, and it really does a fantastic job of covering all the SQL basics. It provides a background on databases, why the SQL language is so popular today, and an overview of the basic SQL commands and ideas.

Some SQL concepts you are going to want to take away from this book are:

  • Select statements
  • Where clauses (including how to use LIKE)
  • Order by statements
  • Aggregate Functions
  • Grouping Data
  • Working with Sub-Queries
  • Joining Data

I recommend reading the book from Chapter 1 through Chapter 14. After Chapter 14, the book focuses more on configuring databases like inserting, and deleting rows. This is not relevant to know for someone pursuing a marketing analytics or sales strategy role, so I recommend skipping over these chapters if that is your goal.

There are two topics that aren’t covered in this book that you’ll want to know to ace your SQL interviews. And one of them is “Window Functions”. For me, this topic came up in all of my SQL interviews. Specifically, I think it is good to understand the below Window Functions concepts:

  • RANK()
  • DENSE_RANK()
  • ROW_NUMBER()
  • Using “Over ()” and “Partition by” and “Order By” properly

This article does a great job summarizing what these concepts are, there are also a lot of helpful YouTube tutorials online as well. Window Functions are more confusing than basic SQL commands, so I recommend devoting at least a few hours in learning this concept to give yourself a chance to thoroughly go over this topic and understand it.

Secondly, I recommend learning how to use CTEs (Common Table Expressions). This article helps. CTEs are also known as temporary tables. These tables are very valuable and can transform even the most complex SQL questions into a series of simple SQL tables. The use of these tables also help break down a problem and make it easy to explain the solution to your interviewer. Learning CTEs is a must!

Okay great! You learned what you needed and now it’s time to practice!

I visited many websites looking for a good site to practice SQL (it is surprisingly difficult to find a good one). After exploring many sites my go-to site became stratascratch.com. Personally, I love this site. It gives excellent instructional problems that are realistic in an interview setting. Part of practicing is making sure you don’t get tripped up on the day of the interview. It’s never fun seeing a question for the first time in an interview. To avoid this letdown make sure you practice, practice, practice!

Some tips for using the site:

  • Start with the free version. I eventually signed up for the paid version for this site for 2 months. It was $32 a month. It was nice to have access to more problems, but I don’t think it’s necessary. My recommendation is to do all the free problems before considering the paid version.
  • Use the filters. This will get you more targeted questions based on your needs. Some of the top companies actually submit questions to the site. Check out the “Company” filter to see if the company you’re interviewing at submitted questions to the site. The “Topics” filter is also helpful to hone your skills for a particular topic.
  • Review the discussions and comments. This will show you how other people solved the problem. Part of SQL interviews is being able to accurately explain the topic to the interviewer (understand the “why” behind the problems). Understanding how others solved the same problem really helps with this.
  • Don’t be afraid to experiment! Try to solve problems multiple ways. Also, test out different commands in the SQL input window to get familiar with what data gets returned.
  • Go through the easy and medium questions first. The hard problems can be time consuming are there many valuable concepts that can be learned by tackling the easy and medium level difficulty questions first.

After completing the free and paid practice problems on stratascratch.com, if you’re still craving more practice problems, I recommend checking out leetcode.com. This site is more popular for traditional programming questions but it has many SQL/database practice problems as well. This site requires a subscription, which I believe is $30 a month.

The last thing I want to call out is SQL classes. I’ve personally taken 2 SQL classes — one at UC Berkeley and another through a career type program. I didn’t get a lot of value out of these classes. They tend to focus on more beginning level SQL concepts, and by the time “new” concepts are introduced the class is 75% done. These classes can also be expensive. Again this is just my experience — I think SQL is intuitive enough that the books and online resources are sufficient and will allow you to choose your own learning plan (hint follow the learning plan outlined in this post).

Interview Tips:

  • Review a SQL Cheat Sheet a day or two before the day of interview to quickly refresh concepts before an interview.
  • Do at least 2–3 practice problems (even if you already completed them before) to get you in the right headspace for working on SQL problems. Also practice saying out loud why you’re coding in a certain way. Being able to verbally communicate to your interviewer why you’re coding in a certain way is sometimes just as valuable as what you’re coding.

So to quickly recap, start with reading the SQL in 10 minutes book to understand the SQL basics, then study and understand window functions and CTEs, then use the free version of stratascratch.com to practice.

If you feel like you need more practice, get the paid version of stratascratch.com, and then if you want even more practice, sign up for leetcode.com.

With this SQL interview plan in place, you will crush your SQL interview!

--

--