DEV Community

Vigneswaran Manivannan
Vigneswaran Manivannan

Posted on

JOINS- 19-06-2025

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

***Different Types of Joins
*

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

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

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

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

**

INNER JOIN- SYNTAX

**
select column1, column2
from table1
join
table2
on table1.column = table2.column;

select n.name,n.country,s.division,s.gender from new_staff_details n inner join staff_details s on n.name=s.name;

LEFT JOIN-

select column1, column2
from table1
left join
table2
on table1.column = table2.column;

select n.name,n.country,s.division,s.gender from new_staff_details n left join staff_details s on n.name=s.name;

RIGHT JOIN-

select column1, column2
from table1
right join
table2
on table1.column = table2.column;

select n.name,n.country,s.division,s.gender from new_staff_details n right join staff_details s on n.name=s.name;

FULL JOIN-

select column1, column2
from table1
Full join
table2
on table1.column = table2.column;

select n.name,n.country,s.division,s.gender from new_staff_details n full join staff_details s on n.name=s.name;

Image description

Top comments (0)