Built-In Course

Learn SQL while querying real files

SQL for Files includes 80 guided lessons in 17 chapters, with 71 hands-on challenges that check your query result automatically. Lessons open directly in the editor: load sample tables, run SQL with autocomplete, and practice without installing a database.

Practice in the editor

Lessons use the same Monaco editor, DuckDB engine, and results panel as your own imported files.

Load sample data

One-click sample tables make it easy to run examples before bringing your own CSV, JSON, or Parquet files.

Keep data local

Use AI to draft SQL if you want, then run it locally without uploading sensitive file data to an AI provider.

00

Understanding Data

Build the mental model behind SQL: how tables store rows and columns, why data types matter, and how missing values work with NULL.

01

Introduction to SQL

Write your first SELECT queries: return rows, choose columns, rename results with aliases, and sort output with ORDER BY.

02

Filtering Data

Narrow results to the rows you need with WHERE, combine conditions with AND and OR, and match text patterns with LIKE.

03

Simple Aggregates

Summarize a whole table into single values with COUNT, SUM, MIN, MAX, and AVG.

04

DISTINCT and GROUP BY

Remove duplicates with DISTINCT, summarize per category with GROUP BY, and filter grouped results with HAVING.

05

Working with Dates

Filter by date ranges, extract parts of dates, and calculate the days between two dates in DuckDB SQL.

06

JOIN Types

Combine related tables with INNER, LEFT, RIGHT, FULL OUTER, SELF, and CROSS JOIN, and find rows that have no match.

07

Window Functions

Calculate totals, running sums, rankings, and previous-row comparisons with OVER and PARTITION BY while keeping every detail row.

08

Execution Order

Understand the logical order in which SQL evaluates FROM, WHERE, GROUP BY, HAVING, window functions, SELECT, ORDER BY, and LIMIT.

09

Normalization

See why well-designed databases split data into related tables, feel update, insert, and delete anomalies, and learn 1NF, 2NF, and 3NF.

Lesson 01 · Theory

Why Normalization Matters

Understand what database normalization is, why each fact should be stored in one place, and how it prevents inconsistent data.

Lesson 02 · Challenge

Feel the Update Anomaly

Experience an update anomaly in a flat orders table, where one customer's city is repeated on many rows that would all need changing.

Lesson 03 · Challenge

One Row to Update in a Good Schema

See how a normalized customers table turns a risky multi-row update into a change to a single row, then query that one row.

Lesson 04 · Challenge

Feel Why Packed Lists Break 1NF

Discover why comma-separated lists in a single column break first normal form, and why searching them with LIKE is fragile.

Lesson 05 · Challenge

Order Items Feel Better

Model order lines in their own order_items table to satisfy first normal form, then find orders that contain a product with a JOIN.

Lesson 06 · Challenge

Feel the Delete Anomaly

Experience a delete anomaly, where removing an order row would also erase the only record of a product, using GROUP BY and HAVING.

Lesson 07 · Challenge

Products Can Exist Without Orders

See how a separate products table fixes insert and delete anomalies, and find products that have never been ordered with a LEFT JOIN.

Lesson 08 · Theory

1NF, 2NF, and 3NF

Learn what first, second, and third normal form require, with short examples of the dependency problems each normal form removes.

Lesson 09 · Theory

Why We Build Tables in Normal Forms

Review why teams design tables in normal forms, from cleaner updates to better data quality, and when denormalizing is a deliberate trade-off.

10

GROUPING SETS, ROLLUP, and CUBE

Produce subtotals and grand totals in a single query with GROUPING SETS, ROLLUP, and CUBE.

11

UNNEST

Flatten DuckDB lists and structs into rows and columns with UNNEST, including recursive flattening and max_depth.

12

Array Lambdas

Transform, filter, and reduce DuckDB list columns with lambda functions such as list_transform, list_filter, and list_reduce.

13

CASE WHEN Expressions

Add conditional logic to queries with CASE WHEN: label rows, bucket numbers, map codes to readable values, and count or sum only the rows that match.

14

Subqueries and CTEs

Nest one query inside another with subqueries, test membership with IN and EXISTS, and break long queries into named steps with WITH (common table expressions).

15

Set Operations: UNION, INTERSECT, EXCEPT

Combine the results of two queries: stack rows with UNION and UNION ALL, find rows both sides share with INTERSECT, and find rows only one side has with EXCEPT.

16

String Functions

Clean and reshape text with SQL string functions: change case, trim spaces, concatenate values, extract parts of strings, and replace patterns with regular expressions.