Start learning SQL
Jump into our free, engaging SQL course and become a skilled data analyst faster than you can say “left join”.
SQL is one of the most important data languages today. Mastering it is essential to becoming a strong analyst.
This course walks you through SQL fundamentals step by step.
▌SQL Tutorial
Start from scratch with the introductory lesson, or jump directly to the skill you want to develop.
Lesson 1 • Introduction
Introduction: Analyzing Data with SQL
In this introductory lesson, learn what SQL is, what you can do with it, and how you can start honing your skills.
Lesson 2 • Preparation
Connecting data, tables, and creating a model
The first step in getting going with SQL is connecting your data and tables and learning the architecture for building your first model.
Lesson 3 • SELECTing
SELECTing your first data with SQL
The most basic SQL query grabs data from a table, and consists of a SELECT statement and a FROM statement.
Lesson 4 • Filtering
Introduction to filtering (WHERE)
The SQL WHERE clause filters the rows a query returns based on their content. How it works, with examples you can run on your own data.
Lesson 5 • Filtering
Using !, =, <, > to filter data in SQL
You can use symbols like !, =, <, and > to filter data in SQL. Learn the basics of how each symbol works.
Lesson 6 • Filtering
AND / OR: Filtering your data with several conditions
Learn how to combine several conditions in your ‘where’ statement by using the statements ‘and’ & ‘or’.
Lesson 7 • Filtering
Filtering on non-exact values with LIKE
In cases where you're unable to define the conditions exactly, you can use 'like' clause to filter on values that match more or less.
Lesson 8 • Filtering
Filtering when conditions are NOT fulfilled
To filter out based on values that are not exact, you can use the 'not' statement.
Lesson 9 • Creating Columns
Introduction to columns
In this section of the tutorial, you’ll work with something new: creating new content to be included in your table.
Lesson 10 • Creating Columns
Creating a new column and naming it AS something
Apart from selecting columns from the existing data, it’s also very simple to create new columns, and name them using 'as'.
Lesson 11 • Creating Columns
Making calculations in columns
Creating your own columns in SQL becomes even more useful for business analysis when you include calculations in the columns.
Lesson 12 • Creating Columns
Using CASE WHEN as IF statements in SQL
CASE WHEN is the IF statement of SQL. The syntax, how to combine several WHEN conditions with ELSE, and examples that create new columns.
Lesson 13 • Aggregating Data
Introduction to data aggregation
This lesson introduces data aggregation. More specifically, you'll learn what to expect in this chapter and how to aggregate data.
Lesson 14 • Aggregating Data
Using COUNT, SUM, AVG, MIN, and MAX
COUNT, SUM, AVG, MIN, and MAX are the SQL functions you'll use most for aggregating data.
Lesson 15 • Aggregating Data
GROUP BY and ORDER BY
GROUP BY groups rows so you can summarize them, ORDER BY sorts the result. How each works in SQL and how to use them together, with examples.
Lesson 16 • Aggregating Data
Avoid failing queries with aggregate functions and GROUP BY
Learn to avoid the common causes of fails when using aggregate functions and GROUP BY.
Lesson 17 • Sub-queries
Introduction to sub-queries and CTE
Sub-queries and CTEs are ways to create temporary tables than can then be treated in a separate step in your query.
Lesson 18 • Sub-queries
WITH
The SQL WITH clause defines a CTE: a named temporary result you can query in the next step. The syntax, how to structure the query, and examples.
Lesson 19 • JOINing
Introduction to JOIN
Introduction to the JOIN function. Learn how to increase the width of the resulting table by adding columns from other tables.
Lesson 20 • JOINing
Finding Common Identifiers & Choosing your Primary Table
Joining tables in SQL requires you to have a common identifier between tables A & B. Learn how to find it.
Lesson 21 • JOINing
Using the JOIN function to combine tables
How the SQL JOIN statement combines rows from two tables, how LEFT JOIN works, and a worked example that joins orders to customers.
Lesson 22 • JOINing
Combining CTEs with JOIN
Combining CTEs with JOINs allows you to have an even greater level of data to analyze, without unnecessarily overloading your query.
Lesson 23 • Conclusion
What’s next? Start analyzing your own business data
Congratulations! You've made it through our SQL tutorial. The next step is to start analyzing your own business data.
Lesson 24 • Tips & Tricks
The order of the elements in your query
In order for your SQL query to return any results, your functions should follow a specific order. Learn what that order is in this lesson.
Lesson 25 • Tips & Tricks
LIMITing the amount of data with SQL
Limiting the amount of rows your SQL query returns is a nifty way to see an excerpt of your query's results (or to see if it has no errors).
Lesson 26 • Tips & Tricks
Best formatting practices
Learn the various different ways you can format your SQL code to improve readability and understandability.
Lesson 27 • Tips & Tricks
Documenting your code
Documenting your code ensures that you and others can go back and understand what the code is doing and how it’s structured.