October 28, 2019

SQL JOIN

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

Different Types of SQL JOINs
The different types of the JOINs in SQL:

(INNER) JOIN: Returns records that have matching values in both tables

LEFT (OUTER) JOIN: Returns all records from the left table, and the matched records from the right table

RIGHT (OUTER) JOIN: Returns all records from the right table, and the matched records from the left table

FULL (OUTER) JOIN: Returns all records when there is a match in either left or right table

SELF JOIN 
A self JOIN is a regular join, but the table is joined with itself.

SELF JOIN Syntax
SELECT column_name(s) FROM table1 T1, table1 T2 WHERE condition;

No comments:

Post a Comment