DCubes
SQL module

Lesson 1

Why SQL for data work

Where SQL shows up in DE and analytics, and what this module will teach.

beginner20 minRun on your machine

What you will be able to do

  • Explain why SQL is the daily language of warehouses
  • Name the query skills this module covers
  • See where SQL sits on the DCubes roadmap

Why this matters for data work

Python loads and transforms. SQL is how most teams query the result — dashboards, ad-hoc checks, pipeline tests, and warehouse transforms. If you can join and window cleanly, you are useful on day one of a DE role.

Where SQL shows up

  • Warehouses — BigQuery, Snowflake, Redshift, Postgres: dialects differ, core SELECT does not.
  • App databases — still SQL; grain and indexing habits transfer.
  • Inside jobs — Spark SQL, dbt models, and “run this check after load” scripts.
  • Interviews — still overwhelmingly SQL.

Map of this module

  1. Getting Started (you did this).
  2. psql and the catalog. 3–5. SELECT, types, aggregates. 6–7. Joins and retail join patterns. 8–9. Subqueries and CTEs. 10–11. Window functions (heavy practice).
  3. CASE and set operations.
  4. DDL and reload.
  5. Views and EXPLAIN (intro).
  6. Query habits for DE.
  7. Demo: First SQL shift.

What we will not do yet

  • Full dimensional modeling (facts/dims SCD) — later DE track.
  • Vendor-specific warehouse admin.
  • ORMs or query builders.

Practice on your machine

export PGPASSWORD=dcubes PGHOST=127.0.0.1 PGPORT=15432 PGUSER=dcubes PGDATABASE=retail
psql -c "SELECT count(*) FROM orders;"

You should still see 300.

Next

psql and the catalog