Skip to content
TeachTrails

Free course · 12 lessons · first 2 open, free sign-in for the rest

Learn SQL the way data engineers use it

One shop's real database from your first SELECT to interview problems. Every query shows the actual result it returned, and every lesson ends with what to memorize and interview questions.

  • SELECT, WHERE, GROUP BY and every kind of JOIN
  • Subqueries, CTEs and recursive queries
  • Window functions: ranking, running totals, LAG
  • MERGE, transactions, indexes and query plans
  • Star schema, pipeline patterns, JSON and arrays
  • 50 interview questions with real answers
SQL for Data Engineers: free course covering joins, GROUP BY, window functions, CTEs, MERGE, indexes and star schema

Why it works

Built so it actually sticks

One real database

ShopKart's customers, orders and products are used in every lesson, so each new idea answers a real business question.

Real results

We ran every query on PostgreSQL 18. The result tables you see are exactly what the database returned.

Built for interviews

Each lesson has a 'memorize this' box and interview questions, and the last lesson solves 12 classic problems.

The roadmap

Follow the trail, one part at a time

Each part builds on the one before. Your progress is saved in this browser, so you can pick up where you left off.

0 of 12 parts completed

Start the course
  1. 1
    Part 1·8 minFree previewStart here

    What Is SQL

    What SQL is and why every data job needs it: databases, tables, rows, keys and the five kinds of SQL commands, explained simply with one shop's real database.

  2. 2
    Part 2·11 minFree preview

    SQL SELECT and WHERE

    Learn SELECT, WHERE, AND/OR, IN, LIKE, BETWEEN, NULL, COALESCE, CASE, DISTINCT, ORDER BY and LIMIT, plus the order SQL really runs in, with real results.

  3. 3
    Part 3·10 min Enroll to unlock

    SQL GROUP BY and HAVING Explained with Examples

    Summarise data with COUNT, SUM, AVG, GROUP BY and HAVING: WHERE vs HAVING, COUNT(*) vs COUNT(column), conditional aggregation and ROLLUP, with real results.

  4. 4
    Part 4·13 min Enroll to unlock

    SQL Joins Explained

    Every SQL join made simple: inner, left, right, full, cross, self and anti joins, plus the two join traps that break reports (and how to fix them), with diagrams.

  5. 5
    Part 5·11 min Enroll to unlock

    SQL Subqueries, CTEs and Recursive Queries

    Break hard questions into steps: scalar, IN, EXISTS and correlated subqueries, CTEs with WITH, recursive CTEs for hierarchies, and UNION vs UNION ALL.

  6. 6
    Part 6·14 min Enroll to unlock

    SQL Window Functions

    Window functions made easy: ROW_NUMBER, RANK, DENSE_RANK, running totals, LAG/LEAD, moving averages, top N per group and share of total, with real results.

  7. 7
    Part 7·12 min Enroll to unlock

    SQL INSERT, UPDATE, MERGE and Transactions

    Change data safely: CREATE TABLE with constraints, INSERT, UPDATE, DELETE, upserts with MERGE, transactions with ROLLBACK, ACID, views and materialized views.

  8. 8
    Part 8·11 min Enroll to unlock

    SQL Indexes and Query Performance Explained

    Why some queries are slow and how indexes fix them: B-tree indexes, EXPLAIN plans, sargable queries, join algorithms, and row vs column storage.

  9. 9
    Part 9·11 min Enroll to unlock

    Data Modeling

    Design tables like a data engineer: normalization (1NF to 3NF), star schema, fact and dimension tables, grain, surrogate keys and SCD types, with a real example.

  10. 10
    Part 10·12 min Enroll to unlock

    SQL Patterns Every Data Engineer Uses

    Real pipeline SQL: de-duplication, incremental loads with a watermark, idempotent MERGE, gaps and islands, pivots, date spines and data quality checks.

  11. 11
    Part 11·12 min Enroll to unlock

    JSON and Arrays in SQL

    Query JSON and arrays in SQL: extract fields, filter, explode arrays into rows, build JSON and flatten raw events into tables, with PostgreSQL results we ran.

  12. 12
    Part 12·15 min Enroll to unlock

    SQL Interview Questions for Data Engineers

    50 SQL interview questions with answers, plus 12 classic problems solved and tested: second-highest salary, top N per group, streaks, duplicates and more.

  13. 13
    SQL on Databricks and Snowflake: dialect differencesComing soon
  14. 14
    dbt for SQL pipelinesComing soon

Who it's for

Made for you if…

Complete beginners

You've never written a query and want to start the right way.

Switching to data

You're a developer, tester or analyst moving into data engineering.

Interview prep

You know some SQL and want window functions, modelling and tricky questions to feel easy.

FAQ

Questions students ask

Is this SQL course free?

Yes, completely free. The first two lessons are open to everyone; sign in with Google, GitHub or email and enroll (also free) to read the rest. Enrolling also saves your progress across devices.

Which database do you use?

PostgreSQL, a free and very popular database. Almost everything works the same in Databricks SQL, Snowflake, BigQuery and MySQL; we point out the differences where they matter.

Do I need to install anything?

To practise, install PostgreSQL (free) or use any online PostgreSQL playground, then run the ShopKart setup script from lesson 1.

Is this enough for a data engineering interview?

It covers what SQL rounds ask data engineers with up to 3 years' experience: joins, aggregation, window functions, CTEs, MERGE, performance, modelling and classic problems.

Should I learn SQL before Databricks?

Yes, if you can. Spark SQL, Databricks SQL and Snowflake all build on the SQL you learn here.

✨ Coming soon

Premium Data Engineering Interview Pack

The lessons stay free. This optional pack adds serious interview prep for a one-time ₹499 (taxes included, 7-day full refund). Join the launch list and tell us what you want most. See pricing

What would you want most? (optional, pick any)

Free to join, no payment. Nothing is sold yet. See our privacy policy.

Start with Lesson 1: What is SQL?

About 2 hours 20 minutes for the whole course. Your progress is saved in this browser as you go.

Get new Data Engineering lessons by email

Free. No spam. Unsubscribe any time. See our privacy policy.