GUIDE深度 · Deep dive

SQL JOIN Types and Usage

JOIN combines tables on a key: INNER keeps matches, LEFT keeps all left rows. Put join conditions in ON and filters in WHERE; decide what one row means before GROUP BY.

更新 2026-10-30 · 公式可核验

Types

INNER JOIN: matches on both sides.

LEFT JOIN: keep all left rows; missing right values are NULL.

CROSS JOIN: Cartesian product.

Aggregation

JOIN can multiply rows.

COUNT(*) counts rows; COUNT(col) ignores NULL.

FAQ

ON vs WHERE?

ON controls the join; WHERE filters results, especially with LEFT JOIN.

Does join order matter?

Not logically; it can matter for performance.

Sources

Related calculators

Advanced SQL: 1000 Gamified JOIN and Subquery Cards1000 advanced SQL cards covering JOIN, GROUP BY/HAVING, subqueries, EXISTS, CASE and window functions, in 50 levels with spaced repetition.

More guides

Hiragana vs KatakanaRead guideSpaced Repetition and the Forgetting CurveRead guideOn Readings vs Kun ReadingsRead guideAn N5 Kanji Study OrderRead guide