Self Join in SQL

preview_player
Показать описание

A self join in SQL is where you write a query on one table that joins to the same table a second time. It's used when you have a record in the table that refers to another record in the same table.

A common example is employees and managers, or product categories. Anything with a "hierarchical data" setup may use an SQL self join.

This video shows you what an SQL self join is, how to write one, and how to overcome issues with column names and missing data.

If you have any suggestions for other videos or comments on this one, let me know in the comments below.

Timestamps:
00:00 Introduction
00:12 Self Join definition
01:38 Employee solution
06:03 Final query
06:45 Categories example
07:30 Left Join
Рекомендации по теме
Комментарии
Автор

Thank you, I was struggling to understand self join, but after watching your video, I realised how simple it is.

preciouschinenyenwa
Автор

Man! That CATEGORIES example saved me just in time before creating many tables. Thanks

joel-rgxm
Автор

Thank you so much! I was trying to understand the ON statement in SELF JOINS and you've explained it perfectly.

Moonm
Автор

got here from a course i couldnt understand this self join and Thanks to you it's all clear now. you explained it really well with the perfect examples. Keep up

mdimranhussain
Автор

Definitely needed this and you explained it perfectly

elioko
Автор

THANK YOU. i have read a hundred tutorials and was stuck on the alias. starting with the from and on clauses and explaining the AS is implied and then going back to the select cracked things open for me. much appreciated.

kim-excn
Автор

Thanks for breaking this down so simply.

kpamiose
Автор

I struggled with an intermediate leetcode sql problem
I didn't want to see the solution right away so i started searchin on sql topics to full the knowledge gap but what i found is actually a video solving the problem itself fuck me

Kornackifs
Автор

Even after a year you are helping guys like me! Thanks for clearing my doubt

Kartik-vjos
Автор

I'm thankful I found this video your explanation is what I needed!

metaman
Автор

somethething that i needed currently for my project. thanks a lot sir

thanzeeljalaldeen
Автор

Thank you for the clear and simple explanation. I remembered seeing the Employee - Manager example somewhere a few years ago, but I couldn't recall where exactly I saw it.

OberynPinkViper
Автор

Nicely explain in simple terms...checked many of your videos too... I am being SQL developer, liked your work 👍

dhruvitmodi
Автор

This is super helpful! Your voice is almost like listen to ASMR, lol. Nice to listen to

ExcelTutorials
Автор

Thank you so much for this clear explanation

quynhanhnguyenthi
Автор

your explaining is great thank u..and good luck

slimandahra
Автор

thank you! been lurking in your channel for a while now, great content sir!

astorgadexterpelaez
Автор

9:05 writing query and making er diagram is so much helpful

gauravsrivastava
Автор

Great explanation just one doubt in the ER diagram for both examples of self join why did you show 1:many relationship?

aakash
Автор

Huge thanks for such a clear explanation! Helped a lot!

Maria-ngl