SQL JOINS

JOIN clause is used to combine two or more tables, based on a related column between them.

Types of joins:

INNER JOIN

LEFT (OUTER) JOIN

RIGHT (OUTER) JOIN

FULL (OUTER) JOIN

  • INNER JOIN: It returns matching values from both tables.
  • LEFT (OUTER) JOIN: It returns all the records from the left table and matching records from the right table.
  • RIGHT (OUTER) JOIN: It returns all the records from the right table and matching records from the left table.
  • FULL (OUTER) JOIN: It returns all the records when there is a match in either left table or right table.

INNER JOIN

RIGHT (OUTER) JOIN

LEFT (OUTER) JOIN

FULL (OUTER) JOIN