Working with SQL

Learn SQL basics and best practices

Working with SQL

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