Sukriti Macker Profile picture
Jun 9, 2021 β€’ 14 tweets β€’ 5 min read β€’ Read on X
Have you found the concepts of JOINS in SQL tricky? πŸ˜΅β€πŸ’«

A Beginner-Friendly JOINS guide that would help you in your SQL & Data Science Journey.

Thread 🧡
β˜‘οΈ JOINS (Some Theory)
Using JOIN, we can query data from two or more tables based on the related column present in both tables.

While performing a join, we need to specify the shared column & the condition on which we want to join tables.
β˜‘οΈ Types of JOINS:-
1. Inner Join
2. Left Join
3. Right Join
4. Full Join
β˜‘οΈ Inner Join
This join query would return rows when there is AT LEAST ONE ROW in both the tables that match the specified join condition.

πŸ‘‰ Query: select tablename1.col1, tablename2.col2 from tablename1 INNER JOIN tablename2 ON tablename1.col1 = tablename2.col2 Inner join of the two tables.
In the above query,

1. tablename1.col1 means the column1 in tablename1

2. We have to mention after the SELECT keyword which columns we want to apply Join Function on.

3. tablename1.col1 = tablename2.col2 is the condition using which we want our INNER JOIN to consider.
Consider an example of 2 tables having 2 columns each, namely ID and Name.

See the tables in the figure below:- Table 1Table 2
We perform a query to find the inner join.

Query -> select * from table1 inner join table2 on table1.name = table2.ID

i.e. selecting all the columns from table1 & table 2 to perform an inner join on the condn that name col of table1 = ID col of table2 Query for Inner Join
Look at the following explanation for the above query performed for more clarity:-

See Image Explanation for an inner join query
β˜‘οΈ Left Join
Using LEFT JOIN, the query returns all the rows from the left table and only those rows from the right table where the join condition is matched.

Query: select tablename1.col1, tablename2.col2 from tablename1 LEFT JOIN tablename2 ON tablename1.col1 = tablename2.col2 Left Join
Example: Consider the same 2 tables we considered for the inner join.

Query: select * from table1 LEFT JOIN table2 on table1.name = table2.ID

Observe the results in the image below. Result of a LEFT JOIN Query
Notice that the left table, i.e. the table 1, is entirely printed, and only those values of table 2 (the right side table) are printed where the join condition is met.
β˜‘οΈ Right Join
It functions similar to the left join, but the only difference is that it returns all the rows from the RIGHT table and only those rows from the left table where the join condition is matched. Right Join
Query: select * from tablename1 RIGHT JOIN tablename2 ON tablename1.col1 = tablename2.col2

Try to implement this one yourself. :)
β˜‘οΈ Full Join
It returns all rows when there is a match in either the left or the right table. Full Join

β€’ β€’ β€’

Missing some Tweet in this thread? You can try to force a refresh
γ€€

Keep Current with Sukriti Macker

Sukriti Macker Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @Sukriti_Macker

Apr 4, 2022
Machine Learning Roadmap for BEGINNERS with resources!! πŸ€–πŸ§΅

1. Study mathematical concepts:-
a) Linear Algebra
b) Calculus
c) Probability
d) Statistics

2. Pick your programming language (preferably Python)
3. Start of with the basic Machine Learning Algos

4. Projects

5. Practice, practice, practice

Resources πŸ‘‡πŸ§΅
A) Linear Algebra
πŸ”— khanacademy.org/math/linear-al…

B) Calculus
πŸ”— youtube.com/playlist?list=…

C) Probability
πŸ”— edx.org/course/probabi…

D) Statistics
πŸ”— Notes: mathsbox.org.uk/twi/astats.pdf

πŸ”— Lec:
Read 5 tweets
Jan 31, 2022
Let's talk about R, shall we? πŸ‘©β€πŸ’»

8 Top Courses (FREE & Certification) for R Programming!! πŸ‘‡ 🧡
➑️ R Programming by @freeCodeCamp
Free 2 Hours course to get you started!

πŸ”—
➑️ R Programming by @simplilearn
Free 7 Hours course. Great for Beginners!

πŸ”—
Read 10 tweets
Jan 24, 2022
Statistics plays a crucial role in Data Science!! πŸ“Š

Do you should know how to understand & interpret your data?? πŸ€”

Top FREE Courses for Statistics you must check out πŸ‘‡πŸ§΅
➑️ FreeCodeCamp on YouTube

πŸ”—
➑️ KhanAcademy
This learning platform is the best! I just love it.

πŸ‘‰ High School Level Stats (for foundation)
πŸ”— khanacademy.org/math/probabili…
Read 7 tweets
Jan 11, 2022
Being in the industry of data science and machine learning, I cannot stress the importance of knowing Microsoft Excel. 🀯

Top 4 Free MS Excel Resources πŸ‘‡ 🧡
➑️ Microsoft Excel by freeCodeCamp

➑️ Microsoft Excel by Edureka

Read 6 tweets
Nov 27, 2021
Looking for Linux Command Line Courses?
Look no further! 🀩

Top 4 Free Linux Command Line Courses πŸ‘‡πŸ‘‡
Some might not know the answer to:-

What is Linux?? ➑️ linux.com/what-is-linux/
➑️ Linux Commands by Edureka
πŸ”—
Read 7 tweets
Nov 20, 2021
Learn Git and GitHub together!

Some of you may be new to the programming world. Don't worry! I got you. πŸš€

5 Top FREE resources for Git & GitHub πŸ‘‡ 🧡
➑️ Git and GitHub for Beginners - Crash Course
πŸ”—
➑️ Git & GitHub Crash Course For Beginners
πŸ”—
Read 7 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us!

:(