How to Learn SQL Online
SQL is one of the most important languages to learn if you want to get ahead in data science. Almost all the world's data exists in databases, and SQL is the language you'll need to use to access and analyze most of that data. But learning SQL can sometimes be a frustrating experience. In this article, we'll share the tips and tricks that will help you learn SQL online.
In order to understand how to learn SQL online effectively, let's take a moment to understand a few key things about SQL.
SQL Data is Structured
SQL standards for Structured Query Language. When you're working with SQL, you're almost always working with data in databases, which is structured into multiple tables. You write queries in order to select specific data and transform it to your needs.
A lot of SQL work involves using joins to connect specific data from different tables so that you can analyze it.
There Are Many Different "Flavors" of SQL
There are different versions (or flavors) of SQL. Some of the best known are SQL Server, PostgreSQL, Oracle, MySQL, and SQLite. This can raise questions for someone about to start their learning — which do I choose?
The short answer is that it doesn't matter. The vast majority of the syntax that each SQL flavor uses is the same — the difference between “flavors” is mostly optional functionality added on top. Moreover, almost all of the SQL syntax you'll learn as a beginner is common to all SQL flavors.
As a beginner, pretend that all these different flavors don't exist, and just focus on learning SQL basics. Treat them the same until you get to a more advanced level and need to worry about the differences.
One exception to the advice above is for NoSQL databases. NoSQL databases, as the name implies, aren't really SQL databases in the traditional sense. While NoSQL databases have recently grown in popularity and seem like a "sexy" thing to learn, their usage is minuscule compared with "real" SQL flavors, and you're much better off spending your time learning SQL, from which you will get a lot more value.
Learn SQL by Doing SQL
In order to learn SQL effectively, you're going to have to have to write a lot of queries. This means that in order to succeed in learning SQL online, you can't just rely on video or text-based courses and think that it will be enough. You're going to have to put what you've learned into practice. You'll need some sort of setup where you can write queries and work with real-life data.
Finding structured data to learn SQL with is extremely difficult. While there are thousands of data sets online that are useful for learning, almost all of them are 'flat files' — a fancy word for unstructured.
In order to learn SQL, you'd need to find interesting data and then prepare it by splitting it into multiple tables before you could practice. This creates a really high barrier to get started.
Additionally, getting database software installed on your computer can be finicky and time-consuming. It’s easier to stay motivated when you can dig right in and start writing queries, not spend hours preparing to get started.
The solution? Find a course where you can learn SQL online by writing SQL queries right in your browser. Not only does this save you the time and effort of setting things up on your computer, you'll also be able to work with structured data that mirrors real-world SQL use cases.
There are a small number of sites that provide this sort of quick-start environment for learning SQL online. One of them is with us — Dataquest — we have specifically designed our learning interface to provide the ideal environment for learning SQL.
But wherever you choose to learn, remember the importance of putting it into practice early and often. If you’re “learning SQL” but not actually writing and running SQL queries to apply what you’re learning, chances are you’ll have a tough time when it’s time to work with SQL in the real world.
Prepare Yourself for Tough, Real-World SQL
The next thing to keep in mind while learning SQL online is that writing SQL in the real world is complex. We spoke briefly earlier about how you'll need to use joins to connect data from across multiple database tables.
Most courses don't prepare you for the complexity of writing queries using many joins, so you're going to want to find a course that goes beyond the basics. You want to find a course that will stretch you and teach you to do the tough things (or create such a curriculum for yourself).
You'll also need data that's complex enough to practice this on — a lot of SQL courses will teach you joins using databases that have two or three tables. But often you'll need to join four or more tables while writing SQL in the real world, so it’s best to start confronting this complexity while you’re learning, rather than having to deal with it for the first time when you’re on the job.
At Dataquest, our SQL courses start from scratch, but they'll take you beyond the basics so you're prepared to write SQL in the real world. The image above shows a SQL query that you'll be able to write once you've taken our intermediate SQL course.
Practice Answering Questions Using SQL
When working with SQL, there is a common workflow you're going to see over and over again:
- Understand the question you need to answer with the data.
- Formulate the structure of the data that will answer your question.
- Write a SQL query that transforms data from database tables in order to answer your question.
Doing these steps takes a lot of practice. An ideal way to get practice is to build projects, but as we discussed earlier, there are lots of barriers to building a SQL project on your own. That doesn’t mean you can’t do it, but it will definitely be a challenge!
At Dataquest, each of our SQL courses has one or more guided projects, where you can analyze data that we've prepared for you to practice the real-world analysis workflow.
Next Steps: Start Learning SQL Online
If you want to succeed in the world of data, you're going to have to be comfortable with SQL. If you're ready to get started, you can take Dataquest's entire SQL Fundamentals course for free, today, without leaving your browser:
Data Scientist at Dataquest.io. Loves Data and Aussie Rules Football. Australian living in Texas.