Middle
Name the main types of JOIN operators in SQL language
sobes.tech AI
Answer from AI
Main types of JOIN operators in SQL:
- INNER JOIN — returns rows with matches in both tables.
- LEFT JOIN (LEFT OUTER JOIN) — returns all rows from the left table and matching rows from the right; if no match, the right side will be NULL.
- RIGHT JOIN (RIGHT OUTER JOIN) — the opposite, all rows from the right table and matching rows from the left.
- FULL JOIN (FULL OUTER JOIN) — returns all rows from both tables, with NULLs in place where there are no matches.
- CROSS JOIN — Cartesian product of two tables, each row of the first table is joined with every row of the second.
Example of INNER JOIN:
SELECT employees.name, departments.name
FROM employees
INNER JOIN departments ON employees.department_id = departments.id;