Prev     Next

  • SQL JOINS are used to combine rows/records from different tables.
  • Rows can be combined from either 2 tables or more than 2 tables as per our need using SQL JOINS. The result will be displayed as single table after combining.

Uses of SQL JOIN clause:

  • Generally, SELECT SQL can select columns only from one table. But, with the help of SQL JOINS, SELECT SQL can select any columns from any table.
  • SQL joining is possible between 2 tables when there is at least one common column available in those tables.
  • SQL INNER JOIN is the most common join used for joining 2 tables. This type of join is also called as ‘simple join’.

There are different JOINS that can be performed in SQL. They are,

  1. SQL – Inner Join (Simple Join)
  2. SQL – Left Join (Left outer join)
  3. SQL – Right Join (Right outer join)
  4. SQL – Full Join (Full outer join)
  5. SQL – Self Join
  6. SQL – Cartesian Join or Cross join

SQL – Inner Join:

Table1, Table2

Inner join

SQL – Left Join:

Table1, Table2

Left join

SQL – Right Join:

Table1, Table2

Right Join

SQL – Full Join:

Table1, Table2

Full Join

SQL – Self Join:

Table1 & Table2

Self Join

SQL – Cartesian Join:

Cartesian Join

Type of SQL JOINS Description
SQL – Inner Join (Simple Join) It is used to combine two or more tables together using the matching columns from both tables.
SQL – Left Join (Left outer join) LEFT JOIN selects all records from left table and also selects all matching records from the right table.
SQL – Right Join (Right outer join) RIGHT JOIN selects all records from right table and also selects all matching records from the left table.
SQL – Full Join (Full outer join) FULL JOIN selects and returns all records from both left and right tables.
SQL – Self Join Self Join is used to join a table to itself.
SQL – Cartesian Join or Cross Join Cartesian Join returns the Cartesian products of 2 or more tables joined together.

Prev     Next

Like it? Please Spread the word!