SQL tutorial •
Lesson
1
,
Introduction

Introduction: Analyzing Data with SQL

All lessons

This tutorial covers the steps of cleaning and transforming raw data in your data warehouse to get meaningful business insights out of it. This guide is intended for all people involved in business data analytics — whether you’ll perform the analysis yourself or manage somebody carrying out the analysis, a basic understanding of SQL is an important skill for anyone in the analytics field.

Why should you start learning SQL?

For some, starting to learn a coding language like SQL can seem a bit overwhelming or unnecessary, especially if data analytics isn’t at the core of your work. But once you take this first step towards treating your data in a serious way, you’ll be able to quickly look up all sorts of details in your data, perform deeper analysis in a few steps, or understand what others have done in SQL before you. This seriously speeds up how you work with data, and supports much faster data-driven decisions in your whole organization. And after investing a few hours or an afternoon into learning SQL, you’ll already be able to start working with and analyzing your own data.

An alternative to working in SQL is to stay in Excel or Google Sheets for your data work. Performing analysis in spreadsheets can work for many instances (and sometimes it can still be super beneficial to export your results in SQL back into a spreadsheet for the final analytical steps), but you’ll quickly be limited in terms of the amount of data you can treat in Excel, and it will never be as replicable as with SQL.

Data tooling options

There are tools on the market that attempt to work with the same amounts of data as in SQL in a replicable way without writing any lines of code — but often these tools are still relying on similar logic as SQL, which means you’ll still have to understand how data modelling works and how to set up the correct logic to make it work. You can just as well learn to write the code right away as you’ll likely stumble into all the same issues anyway. Even if you manage to set up some analysis in a no-code tool, any time something is off in the data, it will be difficult for you to trust the tool to manage the data for you. With just a basic understanding of SQL, you’ll be able to quickly see where your data is coming from, how it’s transformed, and where it’s going. This way, you’ll be in full control of the way you use data at your business.

With a basic SQL understanding and a data platform like Weld, you’ll be able to quickly grab the data you need from the tools you use in your business, perform aggregations or analysis that drives value for you, and then either automatically send this into a dashboard or reverse-ETL your data back into the tools you use, like HubSpot or Google Sheets. This way, you’ll quickly be able to make truly data-driven decisions for your business — or even automate some of these decisions as the data that was once dispersed in the various tools you use will be available across everything you use in your business.

What can you do with SQL?

It’s important to understand that SQL is used in the modelling layer on top of your existing data. As such, you’re not manipulating your raw data in your data warehouse in any way when you write SQL. Instead, you’re modelling how the data is represented for you and will be processed, for example in your dashboard software. You’ll therefore never mess up anything in your raw data by playing around or experimenting with your SQL code.

The data in your data warehouse will typically be a raw dump of data from the various business tools and sources you’ve connected to it. The data is a mess of unorganized tables, and looking directly at this rarely gives you any meaningful insights. The first step to getting value out of this data is to start cleaning up the way this data is represented for the next steps. This is done in SQL, and a basic understanding of how to write commands is enough to get you started.

Surprisingly, this process is not only valuable for the following steps of analyzing your data but also has tremendous value in and of itself. Having access to clean and structured data gives you much more trust and confidence in making decisions based on data. You can create this for yourself with a platform like Weld and just a little bit of SQL.

Once you’ve started to organize your data, you’ll already be able to extract new and trustworthy insights compared to looking directly at your raw data. But the real value comes when you start performing analysis on your cleaned data. This step will be very familiar to the way you’ve analyzed data in Excel before, but this can be done much faster with more data and replicated with new data seamlessly compared to in spreadsheets.

How do you get started learning SQL?

This tutorial is meant to get you from zero SQL knowledge to performing analysis on your own business data. You’ll start by selecting and filtering some simple data, then move into various aggregate functions to perform more advanced analytics, and finally you’ll learn how to join different data tables into one.

The key concepts are explained in plain text and for each type of function in SQL, there is a small exercise with sample business data attached for you to try out your learnings. It’s best to go through the exercises along with the articles. This will make your SQL work with your own business data in the future much easier.

The Weld Modelling layer is used to demonstrate the lessons. You can use whatever SQL editor you prefer, but if you’d like to follow the steps in the articles, it’s best to sign up free for Weld.

Next up:
Connecting data, tables, and creating a model