- MySQL – CROSS JOIN
Every row on the left paired with every row on the right. The Cartesian product, how CROSS JOIN differs from a comma join with no WHERE (it does not), the row count arithmetic that makes an accidental one so expensive, and the case where you actually want it: generating a complete grid — every product against every size — to find the combinations that are missing.
- MySQL – RIGHT JOIN
RIGHT JOIN is LEFT JOIN with the tables the other way round, and that is very nearly the whole lesson. What it does, the identical query written both ways, why you will almost never see one in a real codebase, and the one honest argument for it — a long chain of joins where flipping the order would mean rewriting every line.
- MySQL – LEFT JOIN
Keeping every row on the left whether or not the right side matches. Where the NULLs come from, the guest-order case the pizza schema is built around, finding rows with NO match using `WHERE right.id IS NULL`, and the single most common LEFT JOIN mistake: putting a condition on the right-hand table in WHERE instead of ON, which turns the whole thing back into an INNER JOIN.
- MySQL – INNER JOIN
Reading columns from two tables in one result. The ON clause and how a join is evaluated, why INNER JOIN and JOIN are the same thing, joining more than two tables — order to item to topping is three deep in the pizza schema — table aliases, joining on something other than a foreign key, and why a missing ON clause silently gives you every row times every row.
- LeetCode 39 – Combination Sum
The backtracking template with one twist: candidates may be reused without limit, which changes exactly one character in the recursive call. Why recursing from i rather than i + 1 is the whole difference, how the start index makes results unique structurally instead of by filtering, and why all-positive candidates are what guarantee the recursion terminates.