0% found this document useful (0 votes)
14 views10 pages

Joins in SQL

Uploaded by

renzler.saya
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)
14 views10 pages

Joins in SQL

Uploaded by

renzler.saya
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/ 10

Joins in SQL

Anish Chakravorty
Follow me on LinkedIn
What Are Joins in SQL?

Joins are used to combine rows from two or


more tables based on a related column.

Why Use Joins?


Retrieve data from multiple tables.
Perform complex queries efficiently.
Inner Join
Inner Join returns rows with matching
values in both tables.

Syntax:

Example:
Left Join
Left Join returns all rows from the left table,
and the matched rows from the right table.
If no match, NULL values are returned.

Syntax:

Example:
Right Join
Right Join returns all rows from the right
table, and the matched rows from the left
table. If no match, NULL values are
returned.

Syntax:

Example:
Full Join
Full Join returns all rows from both tables,
with NULLs for non-matching rows.

Syntax:

Example:
Cross Join
Cross Join returns the Cartesian product of
two tables, pairing each row in the first
table with every row in the second.

Syntax:

Example:
Venn diagram for Joins
Key Notes on Joins

Always specify a condition for Inner,


Left, Right, and Full Joins to avoid errors.

Use Cross Join carefully—it can


generate a large result set.

Visualize joins using table relationships


in your schema.
Follow me to
get more
Information
and content
like this.
Anish Chakravorty
Follow me on LinkedIn

You might also like