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

SQL Joins Query

This guide explains various types of SQL joins including INNER JOIN, LEFT JOIN, RIGHT JOIN, FULL OUTER JOIN, CROSS JOIN, and SELF JOIN, detailing their functionalities and use cases. It emphasizes the importance of joins in data analysis and how they can be combined with subqueries for more complex queries. The document serves as a foundational resource for understanding SQL joins and their applications.

Uploaded by

chwldpk
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)
2 views10 pages

SQL Joins Query

This guide explains various types of SQL joins including INNER JOIN, LEFT JOIN, RIGHT JOIN, FULL OUTER JOIN, CROSS JOIN, and SELF JOIN, detailing their functionalities and use cases. It emphasizes the importance of joins in data analysis and how they can be combined with subqueries for more complex queries. The document serves as a foundational resource for understanding SQL joins and their applications.

Uploaded by

chwldpk
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

A Guide to

SQL Joins
For Data Analysis

Moaz Agha
01
Inner Join
The INNER JOIN is the most commonly
used join in SQL. It returns only the rows
that have matching values in both tables.
02
Left Join
The LEFT JOIN returns all rows from the
left table and the matching rows from the
right table. If there's no match in the right
table, it returns NULL values for the right
table columns.
03
Right Join
The RIGHT JOIN is the opposite of the LEFT
JOIN. It returns all rows from the right table
and the matching rows from the left table. If
there's no match in the left table, it returns
NULL values for the left table columns.
04
Full Outer Join
The FULL OUTER JOIN returns all rows from
both tables, matching rows from both tables,
and NULL values for non-matching rows.
05
Cross Join
The CROSS JOIN returns the Cartesian
product of both tables, which means it
returns all possible combinations of rows
between the two tables.
06
Self Join
A self join is a regular join, but the table is
joined with itself. It's often used to compare
data within the same table.

Table A
Using Joins 07
with Subqueries
Joins can be used with subqueries to filter data
further. In this example, we'll use a subquery to
get the maximum salary for each department,
and then join that with the employees table to
get the employees with that salary.
SQL joins are powerful tools for
working with data across
multiple tables.
This guide provides a solid
foundation to tackle various join
scenarios, but there are always
new challenges to explore.
I am
Moaz Agha
Dont forget to like, share
and save if you like this post

You might also like