Learn SQL
Learn SQL basics, best practices, and debugging tips.
Working with SQL
Learn SQL basics and best practices
Best practices for writing SQL queries
SQL best practices: a brief guide to writing better SQL queries.
11 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
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
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
How to calculate customer lifetime value (LTV) with SQL
Learn how to use SQL to calculate customer lifetime value in Metabase.
5 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