Understanding different types of SQL Joins in simple way

A Join will combine rows from one or more tables and return the resultset.

SELECT u.UserName,u.CountryName from users u inner join country c on u.countryid=c.countryid;

Types of SQL Joins


INNER JOIN:

It returns matching rows from both tables.

LEFT OUTER JOIN:

It returns all records from left side table and matching records from right side table.

RIGHT OUTER JOIN:

It returns all records from right side table and matching records from left side table.

FULL JOIN:

It returns all records from both tables when there is a match in either left side table or right side table.