Learn SQL
Learn SQL for data analysis, best practices, and debugging tips.
Get started with SQL
Metabase is the best way to learn SQL, from beginners just getting started to experts brushing up on their craft.
Introduction
Get set up with Metabase and start querying.
1 min read
SQL querying tables
Learn how to use SQL SELECT, FROM, LIMIT, ORDER BY, and AS to query and sort tables.
8 min read
Working with SQL
Advanced SQL and best practices.
Best practices for writing SQL queries
SQL best practices: a brief guide to writing better SQL queries.
11 min read
Simplify complex queries with Common Table Expressions (CTEs)
CTEs are named sets of results that help keep your code organized. They allow you to reuse results in the same query, and perform multi-level aggregations.
5 min read
Working with dates in SQL
Use SQL to group results by a time period, compare week-over-week totals, and find the duration between two dates.
7 min read
How to calculate customer lifetime value (LTV) with SQL
Learn how to use SQL to calculate customer lifetime value in Metabase.
5 min read
Combining tables with joins
How to combine information from two tables with a join.
6 min read
SQL join types
Learn everything you need to know about using different SQL join types.
7 min read
SQL syntax reference
How does that SQL keyword work again?
4 min read
Debugging SQL
Finding the root cause of common SQL query problems.
Debugging SQL syntax errors
What to do when your query returns an error message.
6 min read
Debugging SQL query logic
What to do when your query returns data that looks wrong.
4 min read
Debugging duplicated data in SQL query results
What to do when your query returns data with duplicated rows or columns.
3 min read
Debugging missing data in SQL query results
What to do when your query returns data that's missing rows or columns.
5 min read