Sobes.tech
Junior

What types of JOINs exist in SQL?

sobes.tech AI

Answer from AI

Types of JOINs 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 table. If no match, NULLs are returned for right table columns.
  • RIGHT JOIN (RIGHT OUTER JOIN): Returns all rows from the right table and matching rows from the left table. If no match, NULLs are returned for left table columns.
  • FULL JOIN (FULL OUTER JOIN): Returns all rows when there is a match in either table. Returns all rows from both tables with NULLs where there is no match.

Example syntax:

SELECT columns
FROM table1
JOIN_TYPE table2
ON table1.column_name = table2.column_name;