SQL JOINs
SQL JOINs — Learn all JOIN types: INNER, LEFT, RIGHT, FULL, CROSS, and SELF JOIN with practical examples. The guide walks through INNER JOIN, LEFT JOIN, RIGHT JOIN, FULL OUTER JOIN, CROSS JOIN, SELF JOIN. INNER JOIN returns only rows with matching values in both tables. It is the most common join type. Syntax: SELECT * FROM table1 INNER JOIN table2 ON table1.id = table2.foreign_id. If no match is found, the row is excluded from results. INNER JOIN is equivalent to JOIN (the INNER keyword is optional). LEFT JOIN (or LEFT OUTER JOIN) returns ALL rows from the left table and matching rows from the right. If no match exists on the right, NULL values are returned for the right table columns. Use LEFT JOIN when you need all records from the primary table regardless of matches in the secondary table. The guide is organized into 6 sections that build on each other, each pairing a prose explanation with real SQL you can run as-is.