0% found this document useful (0 votes)
0 views3 pages

SQL Joins Notes

The document provides an overview of SQL joins, detailing five types: INNER JOIN, LEFT JOIN, RIGHT JOIN, FULL JOIN, and CROSS JOIN, along with their syntax. It also includes a description of SELF JOIN, which involves joining a table with itself. Each join type is explained in terms of the rows returned and how unmatched rows are handled.

Uploaded by

joshilalit2275
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views3 pages

SQL Joins Notes

The document provides an overview of SQL joins, detailing five types: INNER JOIN, LEFT JOIN, RIGHT JOIN, FULL JOIN, and CROSS JOIN, along with their syntax. It also includes a description of SELF JOIN, which involves joining a table with itself. Each join type is explained in terms of the rows returned and how unmatched rows are handled.

Uploaded by

joshilalit2275
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

SQL Joins - Notes

1. INNER JOIN

Returns only the matching rows between two tables.

Syntax:

SELECT columns

FROM table1

INNER JOIN table2

ON table1.column = table2.column;

2. LEFT JOIN (LEFT OUTER JOIN)

Returns all rows from the left table and matched rows from the right table. Unmatched rows from the

right table will be NULL.

Syntax:

SELECT columns

FROM table1

LEFT JOIN table2

ON table1.column = table2.column;

3. RIGHT JOIN (RIGHT OUTER JOIN)

Returns all rows from the right table and matched rows from the left table. Unmatched rows from the

left table will be NULL.

Syntax:

SELECT columns

FROM table1
SQL Joins - Notes

RIGHT JOIN table2

ON table1.column = table2.column;

4. FULL JOIN (FULL OUTER JOIN)

Returns all rows when there is a match in one of the tables. Unmatched rows will have NULLs.

Syntax:

SELECT columns

FROM table1

FULL OUTER JOIN table2

ON table1.column = table2.column;

5. CROSS JOIN

Returns the Cartesian product of two tables. Every row in the first table is combined with all rows in

the second table.

Syntax:

SELECT columns

FROM table1

CROSS JOIN table2;

6. SELF JOIN

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

Syntax:

SELECT A.columns, B.columns


SQL Joins - Notes

FROM table A, table B

WHERE condition;

You might also like