ExitJoins: matching records across datasets1 / 9
Explanation

Start with keys that mean the same thing

How compatible keys, join types, and key cardinality determine which records survive a merge and when rows multiply. · associate

A join combines related rows from two datasets using a matching condition. For example, joining orders to customers on customer_id adds customer attributes to each matching order. Unlike a union, which appends rows, a join matches records and combines their columns.

Compatible keys must identify the same thing and use compatible types and formats. Remove unwanted whitespace, align types, and standardize case only where the identifier rules allow it. Do not blindly convert 007 to 7: leading zeros might distinguish identifiers. If an identifier is unique only within a tenant, match on both tenant_id and customer_id; together these form a composite key.

Check missing keys separately. In SQL and Spark joins using ordinary equality, null does not match null. A null-safe comparison can change that behavior, but use it only when two missing identifiers really should represent a match. The examples in this lesson use ordinary equality.