Learn SQL

Using SQL in Metabase.

Working with SQL

Using SQL in Metabase.

Best practices for writing SQL queries

SQL best practices: a brief guide to writing better SQL queries.

13 min read

Create filter widgets for charts using SQL variables

How to create filter widgets in native SQL queries using basic input variables for text, numbers, and dates.

7 min read

Field Filters: create smart filter widgets for SQL questions

Learn how to use Metabase Field Filters in SQL queries to build filter widgets.

7 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.

9 min read

SQL snippets: reuse and share SQL code

Learn everything you need to know about using snippets in SQL code.

6 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.

7 min read

SQL Snippets vs. Saved Questions vs. Views

Learn about the Metabase features you can use to keep your SQL code organized.

4 min read

Combining tables with joins

How to combine information from two tables with a join.

8 min read

SQL join types

Learn everything you need to know about using different SQL join types.

9 min read

SQL trick: ordering bars in a chart

A simple trick to preserve the order you want the bars to appear in a chart.

1 min read

How to calculate customer lifetime value (LTV) with SQL

Learn how to use SQL to calculate customer lifetime value in Metabase.

7 min read