Bruin Academy

Course

Ask the Data

A practical 15-step course on writing SQL by hand, then auditing the SQL an AI agent writes for you.

Most SQL courses teach you to write queries. This one teaches you to trust them. An analyst starting today will have an agent write most of their SQL, so the scarce skill is no longer typing it. It is reading, auditing, and directing SQL that something else wrote.

A wrong number that looks right is worse than an error, because an error stops and a wrong number ships. This course spends its first half making you fluent enough to read SQL, and its second half turning that fluency into a repeatable audit.

What you'll build

You will work against a small generated retail warehouse: 1,200 orders, 2,880 order lines, 500 customers, and three years of history from 2023 to 2025. One command builds it locally, with no download and no account.

You write SQL by hand first, because you cannot audit what you cannot read. Then you bring in an agent, ask it the course's spine question, and learn the loop that makes its answers safe to use.

generated sample data
  -> your own SQL, written by hand
  -> the same question asked of an agent
  -> read, interrogate, verify
  -> a saved, documented asset

By the end you can set up a real data project with an agent's help, write basic SQL yourself, ask an agent for a query in plain English, and tell whether its answer is right.

How it works

Every lesson starts with a decision, then shows one way to implement it with Bruin and DuckDB. The ideas transfer to dbt, Dataform, SQLMesh, or an in-house framework. Bruin is the environment, not the subject.

The course is terminal-first. You run queries with bruin query and read the output, because a reader who freezes at a real prompt has not learned to audit. The data is deliberately imperfect: NULLs where they matter, a duplicated key, orphan foreign keys. Finding them is the exercise.

The manual instructions remain the source of truth. When you use an agent, read its SQL before it runs, inspect the diff, and check the output before moving on. You do not need a cloud account, a warehouse, a credit card, or any prior SQL. You do not need to know Git either - one lesson has an agent set it up while you watch.

Where the repository maps to the course

The template is self-contained, so a student who starts in the repository can see which lesson each file belongs to:

StepLessonRepository file
1SQL, databases, and agents in plain wordsREADME.md
2What you can and cannot delegatedocs/failure-modes.md
3Set up the project with one promptREADME.md, AGENTS.md
4Meet the warehousedocs/schema.md
5Ask one table a questionqueries/01-first-look.sql
6Count, sum, and groupqueries/02-aggregates.sql
7Join two tables without breaking the numberqueries/03-joins.sql
8Name your steps with CTEsqueries/04-cte.sql
9Ask the agent for a queryAGENTS.md, queries/
10Audit what it wrotequeries/audit-template.md
11Interrogate the logicqueries/anchors.md
12Fix the context, not the promptAGENTS.md, pipeline/assets/
13Save a query as an assetdocs/writing-an-asset.md
14Capstone: find the six wrong queriesqueries/audit-lab/
15Recap and next stepsREADME.md

Before you start

  • A terminal you are willing to type into. No prior SQL required.
  • An AI coding tool: Claude Code, Cursor, or Codex. The setup lesson shows how to install one.

15 steps

Course outline

Start course

Set up the workspace

Install the tools, let an agent build the project, and learn what a warehouse actually is.

  1. 1SQL, databases, and agents in plain wordsWhat a database, a table, a query, a warehouse, and an AI coding agent actually are - defined before anything is assumed.
  2. 2What you can and cannot delegateTell a loud failure from a silent one, and learn why you audit SQL you did not write.
  3. 3Set up the project with one promptOpen a terminal, install Git, an AI coding tool, and Bruin, then generate the sample data locally.
  4. 4Meet the warehouseLearn what tables, rows, grain, and a connection are, then look around the data.

Write your own SQL

Type every query yourself. This is the part you cannot skip.

  1. 5Ask one table a questionWrite SELECT, WHERE, ORDER BY, and LIMIT by hand, and catch your first silent failure.
  2. 6Count, sum, and groupAggregate with COUNT, SUM, and AVG, group by a column, and see how NULLs skew each one.
  3. 7Join two tables without breaking the numberJoin on a key, then catch fan-out and a LEFT JOIN that quietly turns into an INNER JOIN.
  4. 8Name your steps with CTEsBreak a query into named steps with WITH, and learn the order SQL actually runs in.

Bring in the agent

Ask in plain English, read what comes back, and interrogate it.

  1. 9Ask the agent for a queryTurn a plain-English question into a well-formed request, and always read the SQL first.
  2. 10Audit what it wroteRun a seven-point checklist over an agent's query, and verify the number a second way.
  3. 11Interrogate the logicPush back on an agent's query with four moves, and reconcile every answer against anchors.
  4. 12Fix the context, not the promptWrite a correction into the repository so it holds for every future conversation.

Make it stick

Save your work, then prove you can catch a wrong answer.

  1. 13Save a query as an assetTurn an audited query into a Bruin asset with a header, dependencies, and a description.
  2. 14Capstone: find the six wrong queriesTen queries all run without error. Exactly six are wrong. Find them, name the fault, and fix each.
  3. 15Recap and next stepsThe habits you built, and where to take them next.

Frequently asked questions

  • Do I need to know SQL to take this course?
    No. The course starts from SELECT and has you writing queries by hand before any agent is involved. Section 2 covers filtering, aggregating, grouping, and joins from scratch.
  • Do I need a database or a cloud account?
    No. The template generates a small retail dataset on your machine in about a tenth of a second. There is no cloud account, no credit card, and no credentials. An optional MotherDuck path exists if you want a cloud warehouse.
  • Which AI tool do I need?
    Claude Code, Cursor, or Codex. The course is written against the Bruin CLI, so anything that can run a terminal command works.
  • Is the course free?
    Yes. All 15 lessons are open, and nothing in the lesson content is gated. Registration is also free and adds a community channel, office hours, and a certificate.
  • Does it work on Windows?
    Yes, through Git Bash or WSL. Git Bash comes with the Git for Windows installer, and the setup lesson walks through it. macOS and Linux work out of the box.
  • How long does it take?
    About 153 minutes of reading across 15 lessons, including the capstone. Each lesson is 5 to 15 minutes and a section is roughly 25 to 45 minutes, so you can complete one section per sitting. Practice time on top of that runs from hours to days.

Get help & contribute

Sign up to our newsletter

Practical updates on open-source data pipelines, AI analysts, governance, and what we are shipping at Bruin.

The signup form is hosted by Brevo. Allow marketing cookies to load it.