How to learn SQL fast

You are reading this, because it's your job to get data out of a warehouse, and get insights out of your data. Maybe you are doing it full time, maybe you have other responsibilities. If you want to get highly proficient at SQL fast and save yourself time in the long-run - this post is for you.

In this post we discuss the fastest way to get to a very high level of SQL proficiency.

Learning - you can't know it all

As anything in life, at some point, learning a skill has diminishing returns. We want to help you get to a high level of proficiency fast. You will be able to solve your use cases rather quickly. Anything beyond that point needs additional effort and the return of (learning) investment is not that high anymore. Based on your job or where you wanna go, it might still be worth the investment.

Example

Playing through Super Mario might be worth the time, solving the whole game within 5 min might not be worth the effort.

https://www.youtube.com/embed/U7RzoIEoSMY?showinfo=0

… I take it back. Totally worth the effort.

Enough chit-chat, let's get started.

What should I focus on to become highly efficient with SQL fast?

Timeframe

Based on your proficiency with coding & numbers, it might only take you a few days to get really proficient with SQL.

For people with no experience with coding & numbers - 1-2 months, and you will be highly proficient. From zero to SQL wizard.

10 things to get you from 0 to SQL master

  1. It's all about the fundamentals - Know the basics of SQL
  2. Do it like Naruto - Practice, Practice, Practice
  3. Only reality is real, bro - Do real life use cases as soon as possible
  4. Be German - Know in which order Queries are executed
  5. How deep is your love - Learn Subqueries & CTEs
  6. Feel the queries - Know the most essential SQL commands by heart
  7. Shortcuts are things you should take - Know the most important shortcuts
  8. Finding Mister Miyashi - Ask people who are very good at coding for their best productivity hacks
  9. Ascend to the cloud - Learn how to use a data warehouse
  10. not typing is faster than typing - Know a little bit of coding to automate your queries

1-7 are basics to advanced

8-10 will get you to Super Saiyan Level

It's all about the fundamentals

A great way to get started is the tutorial from Mode. It's very well done and has some exercises to go along with the lessons. You can also sign up for free and use their sample data sets to practice your SQL.

When you already know a coding language, then this course will take you around 1-5 full days to finish.

If know are completely new to coding and come from an Excel background (i.e. are proficient with numbers) this might take you 2 weeks.

Best to do points 1 and 2 together - meaning - do a bit of theory and then practice.

Do it like Naruto

When you know your basics, start practicing right away. Don't get stuck on theory. You didn't become a great football player, dancer, gamer [insert something you are really good at here] by knowing the rules in and out. Why would you with SQL?

https://www.hackerrank.com/domains/sql

This is a great place with many SQL exercises (around 50-60)

Should take you a few days to solve them.

1-4 days for proficient SQL users, 1-2 weeks for newcomers.

If you can't solve the hard ones, that's totally fine. In real life, you don't have to solve such hard problems and when you do, you'll figure it out.

Only reality is real, bro

Here are some ideas.

Or just search for SQL projectson Google

Or do the work you were hired for…

A project could take you a few days or longer

Be German - follow order

Knowing this will help you understand, why some of your queries don't work like you intend them to. This is really important on your way to becoming a SQL Sage.

https://sqlbolt.com/lesson/select_queries_order_of_execution

This should take you less than 1h

How deep is your love

Learn what they are, why to use them, how to use them and practice.

Here you go

This should just take you an hour.

Here is more

Don't go too deep into subqueries - it's unreadable —> hard to debug —> bad practice at some point

Feel the queries

Don't worry, if you have followed this far, you should be good. Also in Y42 we do a lot of auto-completion for you.

This is basically a freebie.

Shortcuts are things you should take

Unlike in life, in code you should take shortcuts. You should do it a lot. They help you become so blazingly fast, that people will think you have super powers.

At least know the most important ones for now:

Keyboard Shortcuts SQL

It might take a bit to get used to them, but once you do, you'll be much faster.

maybe 1h investment

Finding Mister Miyashi

Ask people for tips as much as you can. Sometimes they'll tell you things you didn't even know you needed but help you improve your skills significantly.

Ask for productivity hacks, how they would go about a problem in general, how they organize their coding environment etc.

What helped them get really proficient.

What concepts, code snippets they use most often

Ascend to the cloud

In the future, you will most probably work with modern data warehouses like Big Query & Snowflake. Know how to use them to save time and money.

https://towardsdatascience.com/14-ways-to-optimize-bigquery-sql-for-ferrari-speed-at-honda-cost-632ec705979

More advanced BigQuery

Use your data warehouse to it's fullest:

Snowflake: https://www.snowflake.com/blog/10-best-practices-every-snowflake-admin-can-do-to-optimize-resources/

Not typing is faster than typing

Now we are entering advanced land. You don't need this, but a little bit of an investment goes a long way towards SQL sagehood.

I mean, now that you know how to SQL, might as well learn to code a little 🤷‍♂️

https://towardsdatascience.com/jinja-sql-%EF%B8%8F-7e4dff8d8778

This is almost like learning a coding language. You will be able to write SQL code in a very scalable way. People will think, how on earth does this person manage to pull it off? If you get here, you are playing the SQL game on the highest level.

https://geoffruddock.com/sql-jinja-templating/