🗄️ Database Design / Normalization
Beginner
What is a JOIN in SQL?
Answer
A JOIN combines rows from two or more tables based on a related column. Types: INNER JOIN — returns only rows with matching values in both tables; LEFT (OUTER) JOIN — returns all rows from the left table and matched rows from the right (NULLs for no match); RIGHT (OUTER) JOIN — all rows from the right, matched from left; FULL OUTER JOIN — all rows from both tables; CROSS JOIN — Cartesian product (every row of A × every row of B); SELF JOIN — a table joined to itself (e.g., employees and their managers in the same table). Always specify JOIN conditions to avoid accidental Cartesian products.
Previous
What is SQL and what are its main categories of statements?
Next
What are the differences between TRUNCATE, DELETE, and DROP?