// SLIDE 01 — HOOK

CHAPTER 14 — ADVANCED DATABASE USE

A join takes two tables and combines them row by row, using a shared column as the hinge. The shared column is usually a

Chapter 14 — Advanced Database Use — Consider the simplest possible example. A customers table:
NARRATION

A join takes two tables and combines them row by row, using a shared column as the hinge. The shared column is usually a key , an identifier that appears in both tables and means the same thing in both. Consider the simplest possible example. A customers table:

// SLIDE 02 — THE FOUR JOIN TYPES AND WHAT E

THE FOUR JOIN TYPES AND WHAT EACH ONE CLAIMS

Returned — Returned — returned applied to the chapter example.
When To Use — When To Use — returned applied to the chapter example.
The Question It Answers — The Question It Answers — returned applied to the chapter example.
NARRATION

There are four join types, and the choice between them is not a performance choice , it is a correctness choice. Each one answers a slightly different question. INNER JOIN returns only rows where the key exists in both tables. If a customer has no orders, they vanish. If an order has a CustomerID that does not exist in the customers table, it vanishes too. INNER JOIN says: show me only the matched pairs.

// SLIDE 03 — AGGREGATION: COLLAPSING DETAIL

AGGREGATION: COLLAPSING DETAIL INTO PATTERN

You have the joined data. You know which customer placed which order. But you have thousands of rows and you want summar

Aggregation: Collapsing Detail into Patt — The machinery is GROUP BY paired with aggregate functions: COUNT, SUM, AVG, MIN, MAX.
NARRATION

You have the joined data. You know which customer placed which order. But you have thousands of rows and you want summary statistics , how many customers bought more than once, what is the average order value by city, which quarter produced the most revenue. Aggregation is how you collapse a tall table into a short one. The machinery is GROUP BY paired with aggregate functions: COUNT, SUM, AVG, MIN, MAX.

// SLIDE 04 — WHERE FILTERS ROWS. HAVING FIL

WHERE FILTERS ROWS. HAVING FILTERS GROUPS..

The WHERE clause runs before grouping. It removes individual rows from consideration before any aggregation happens. The

WHERE Filters Rows. HAVING Filters Group — The confusion: both look like filtering. The difference is when they run.
NARRATION

The WHERE clause runs before grouping. It removes individual rows from consideration before any aggregation happens. The HAVING clause runs after grouping. It removes groups that do not meet a condition. The confusion: both look like filtering. The difference is when they run.

// SLIDE 05 — THE PROBLEM THAT NORMALIZATION

THE PROBLEM THAT NORMALIZATION SOLVES.

Setup — Setup — normal form applied to the chapter example.
Execution — Execution — normal form applied to the chapter example.
Verification — Verification — normal form applied to the chapter example.
NARRATION

Consider a single table called "sales" that stores everything: customer name, customer email, product name, product price, order date, order total. One row per product per order. A customer who ordered three products on the same day appears three times, with their name and email repeated on each row. One day the customer moves. You update their email in row 1. Rows 2 and 3 still have the old email. Now one customer has two different email addresses in your database. Which is correct?

// SLIDE 06 — FOREIGN KEYS: THE CONSTRAINT T

FOREIGN KEYS: THE CONSTRAINT THAT PREVENTS ORPHANS

A foreign key is a column in one table that references the primary key of another table. It is a declaration: every valu

Foreign Keys: The Constraint That Preven
NARRATION

A foreign key is a column in one table that references the primary key of another table. It is a declaration: every value in this column either matches a primary key in the referenced table, or is NULL.

// SLIDE 07 — DENORMALIZATION: THE TRADE YOU

DENORMALIZATION: THE TRADE YOU MAKE FOR SPEED

Query Simplicity — Query Simplicity — fully normalized schema applied to the chapter example.
Data Integrity Risk — Data Integrity Risk — fully normalized schema applied to the chapter example.
Update Complexity — Update Complexity — fully normalized schema applied to the chapter example.
NARRATION

A fully normalized schema requires joins to answer most questions. Joins cost time. On large tables, joining orders to customers to products to categories before aggregating can take seconds or minutes. For a report that runs overnight, that is fine. For a dashboard that refreshes on page load, it is not. Denormalization is the decision to store pre-computed summaries or redundant columns in a table so that a query does not need a join.

// SLIDE 08 — THE VERIFICATION HABIT FOR SQL

THE VERIFICATION HABIT FOR SQL.

Every join and aggregation in this chapter can produce a plausible-looking wrong answer. A LEFT JOIN that should be an I

The Verification Habit for SQL — The verification habit: before trusting any query result, check it against a small, hand-counted sample.
NARRATION

Every join and aggregation in this chapter can produce a plausible-looking wrong answer. A LEFT JOIN that should be an INNER JOIN does not throw an error. It returns more rows, possibly inflating your counts. An aggregation that double-counts because of a many-to-many join does not throw an error. The numbers just look bigger than they should. The verification habit: before trusting any query result, check it against a small, hand-counted sample.

// SLIDE 09 — EXERCISES

EXERCISES

1.2.3.4.5.
NARRATION

Given the customers and orders tables from the chapter, write three separate queries: one using INNER JOIN that returns only customers who placed at least one order; one using LEFT JOIN that returns all customers; one using FULL OUTER JOIN that returns all customers and all orders including any orphans. For each, state in plain English what question the query is answering and name one scenario where that join type would be the wrong choice.

// SLIDE 10 — AI WAYBACK MACHINE

AI WAYBACK MACHINE.

·Ask it to explain the design choices Chamberlin and Boyce made that distinguished SQL from earlier query languages (like
Ask"Chamberlin's co-author Raymond Boyce died at age 26, the year after publishing the SEQUEL paper. What did Boyce contrib
Add the framing"Answer as if Chamberlin himself were writing the foreword to a 50th-anniversary edition of the original SEQUEL paper"
NARRATION

The ideas in this chapter didn't appear from nowhere. Donald D. Chamberlin was working on SEQUEL (later renamed SQL) , the query language he co-invented at IBM with Raymond Boyce in 1974, which became the universal vocabulary for talking to databases decades before most people had heard of advanced database use and SQL. Here's a prompt to find out more , and then make it better.

// SLIDE 11 — PROMPTS

PROMPTS

Create a single-file D3 v7 HTML process using 4-6 labeled nodes or panels, directional connectors where sequence matters

Prompts — Create a single-file D3 v7 HTML process using 4-6 labeled nodes or panels, directional connectors where sequence matters
NARRATION

Create a single-file D3 v7 HTML process using 4-6 labeled nodes or panels, directional connectors where sequence matters, direct labels on every mark, one primary red emphasis mark, neutral supporting marks, and no unlabeled boxes. The figure should represent: a query execution order diagram showing the sequence , FROM (identify tables) goes to JOIN (combine tables) goes to WHERE (filter rows) goes to GROUP BY (form groups) goes to HAVING (filter groups) goes to SELECT (compute output columns) goes to ORDER BY (sort) , with an annotation at each step naming what exists at

// SLIDE 12 — THESIS

THE CORE CLAIM.

Figure 14.1 — Query Execution Order Diagram

Create a single-file D3 v7 HTML process using 4-6 labeled nodes or panels, directional connectors where sequence matters

NARRATION

Create a single-file D3 v7 HTML process using 4-6 labeled nodes or panels, directional connectors where sequence matters, direct labels on every mark, one primary red emphasis mark, neutral supporting marks, and no unlabeled boxes. The figure should represent: a query execution order diagram showing the sequence , FROM (identify tables) goes to JOIN (combine tables) goes to WHERE (filter rows) goes to GROUP BY (form groups) goes to HAVING (filter groups) goes to SELECT (compute output columns) goes to ORDER BY (sort) , with an annotation at each step naming what exists at that point

// SLIDE 13 — CLOSE

ASK THE QUESTION. APPLY THE FRAMEWORK.

THE FOUR JOIN TYPES AND W//AGGREGATION: COLLAPSING D//WHERE FILTERS ROWS. HAVIN

Workplace Software Skills with Claude · Ch.14 · Chapter 14 — Advanced Database Use

NARRATION

That is the framework. Workplace Software Skills with Claude, chapter 14: Chapter 14 , Advanced Database Use. The patterns are now in place. Apply them.

01 / 13
Workplace Software Skills with Claude · Ch.14 · Nik Bear Brown