liveBook · Manning

Join

As explained in Grokking AI Applications

A relational data operation that combines rows from two tables using matching values in one or more key columns.

A join combines two tables by matching values in a shared key column or columns. It creates a new table that brings together information about the same entity from both sources. Think of it as connecting a customer profile to that customer’s transaction records using CustomerID. section 7.2

First identify the left and right tables and choose the shared key. Then decide which unmatched rows belong in the result. A customer can match multiple transaction rows, so the customer details appear alongside each matching purchase. section 7.2

Including customers without purchases

Customer Master Data is the left table and Transaction History is the right table. Matching on CustomerID links CUST002 to two purchases. Including every left-table row also retains CUST003, whose transaction fields are empty, so that customer can still receive an email. A transaction-only ID such as CUST085 is not retained by this choice. section 7.2

CustomerID

FirstName

Age

City

ProductName

PurchaseDate

Amount

CUST001

Rebecca

53

Manchester

?

?

?

CUST002

Maicol

41

Milan

Sleep Lamp

2025-01-25

439.96

CUST002

Maicol

41

Milan

Essential Oil Diffuser

2025-03-10

288.00

CUST003

Giulia

37

Milan

?

?

?

Inspect the joined result to see repeated customer details for multiple purchases and empty transaction fields for customers without matches. section 7.2

How Grokking AI Applications covers it

How deep it goes
Defines shared-key matching and illustrates how inclusion choices change the resulting rows.
Examples
Uses customer master data, transaction history, CUST002 purchases, CUST003 without purchases, and CUST085 without a master record.
What it assumes
Introduces joins from separate loaded tables and a shared CustomerID key.
What you can do after
Operate/configure it by matching customer and transaction tables on CustomerID while retaining customers without purchases.
How it connects
Connects CustomerID matching to data aggregation, chronological sorting, and personalized emails.

Also explained in

Compare how 16 books explain join →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking AI Applications. The section links point to the parts of the book it draws on.