Section 1: Intro to SQL & The Declarative Shift

Three problems in this SQL module

1. The "How vs. What" Problem (Declarative Language)

Process a big dataset and hand-tune execution across machines. You re-implement filtering, joining, and aggregation yourself, and you tune the execution by hand.

  • The Problem: How do you extract complex insights without manual execution steps?

  • What we learn: Declarative logic. You state what data you want; the query planner decides how to compute it (which scan, which join order). You do not write the execution steps.

2. Checking AI-generated queries

An LLM produces syntactically valid SQL quickly, but the logic is often wrong.

  • The Problem: How do you check that an AI-generated query returns the right rows, not just that it parses?

  • What we learn: You need a mental model of query execution: trace JOIN behavior and use debug tables to verify generated code.

3. The Cloud Scale Problem

A 5 MB CSV fits in your laptop's memory. 50 TB of live user events does not, so the query runs across a cluster.

  • The Problem: How do you make the leap from local datasets to massive-scale infrastructure?

  • What we learn: Writing queries for Cloud Data Warehouses like BigQuery, queries that run across a distributed cluster, where data layout and partition pruning decide cost.