Sunday 13 November 2016

SQL JOINS



SQL JOINS


- SQL JOIN clause is used to combine rows from two or more tables, based on a common field between them.

We have different types of Joins.

INNER JOIN     : Returns rows when there is a match in both tables.

RIGHT JOIN     : Returns all rows from the right table, even if there are no matches in the left table.

FULL JOIN       : Returns rows when there is a match in one of the tables

SELF JOIN        : It is used to join a table to itself as if the table were two tables, temporarily renaming at least one table in the SQL statement.

CARTESIAN JOIN: Returns the Cartesian product of the sets of records from the two or more joined tables.


  • Look at the below image for better understanding of Joins.





No comments: