What are JOINs in PostgreSQL?

Answer

JOINs combine rows from two or more tables based on a related column. Types: INNER JOIN (only matching rows in both tables), LEFT JOIN (all rows from left + matching from right; NULL for non-matches), RIGHT JOIN (all from right + matching from left), FULL OUTER JOIN (all rows from both, NULLs where no match), CROSS JOIN (Cartesian product — every combination). Example: SELECT u.name, o.total FROM users u INNER JOIN orders o ON u.id = o.user_id;. NATURAL JOIN joins on all identically-named columns (avoid — fragile). SELF JOIN: join a table to itself using aliases. Always use explicit ON conditions for clarity and correctness.