1. INNER JOIN: This is the most common type of join used in SQL. It returns rows when there is at least one match in both tables.

Example:

SELECT *
FROM table1
INNER JOIN table2
ON table1.column1 = table2.column2;

2. LEFT JOIN: This join returns all rows from the left table, even if there are no matches in the right table.

Example:

SELECT *
FROM table1
LEFT JOIN table2
ON table1.column1 = table2.column2;

3. RIGHT JOIN: This join returns all rows from the right table, even if there are no matches in the left table.

Example:

SELECT *
FROM table1
RIGHT JOIN table2
ON table1.column1 = table2.column2;

4. FULL OUTER JOIN: This join returns all rows from both tables, even if there are no matches in either table.

Example:

SELECT *
FROM table1
FULL OUTER JOIN table2
ON table1.column1 = table2.column2;

5. CROSS JOIN: This join returns the Cartesian product of both tables.

Example:

SELECT *
FROM table1
CROSS JOIN table2;

Leave a Reply

Your email address will not be published. Required fields are marked *