Want to easily remember the SQL commands for your database? Get my free SQL Cheat Sheets here: databasestar.mykajabi.com/lpkj-sql-cheat-sheets/?
@yawenxue29633 жыл бұрын
I like how you talk :quiet and clear
@DatabaseStar Жыл бұрын
Thanks!
@preciouschinenyenwa849010 ай бұрын
Thank you, I was struggling to understand self join, but after watching your video, I realised how simple it is.
@DatabaseStar10 ай бұрын
Glad it was helpful!
@joel-rg8xm Жыл бұрын
Man! That CATEGORIES example saved me just in time before creating many tables. Thanks
@DatabaseStar Жыл бұрын
No problem, glad it was helpful!
@mdimranhussain1712 жыл бұрын
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
@DatabaseStar2 жыл бұрын
Great to hear!
@kim-ex5cn Жыл бұрын
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.
@DatabaseStar Жыл бұрын
Thanks for the kind words! I’m glad this video helped you understand it.
@elioko36393 жыл бұрын
Definitely needed this and you explained it perfectly
@DatabaseStar3 жыл бұрын
Thanks!
@Moon22m7 ай бұрын
Thank you so much! I was trying to understand the ON statement in SELF JOINS and you've explained it perfectly.
@DatabaseStar7 ай бұрын
Glad it was helpful!
@Kornackifs Жыл бұрын
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
@DatabaseStar Жыл бұрын
Oh is that a good thing or a bad thing?
@Kornackifs Жыл бұрын
@@DatabaseStar I don't maybe I should've solved it on my own 😥
@gauravsrivastava177 ай бұрын
9:05 writing query and making er diagram is so much helpful
@DatabaseStar7 ай бұрын
Glad you found it helpful
@kpamiose2 жыл бұрын
Thanks for breaking this down so simply.
@DatabaseStar2 жыл бұрын
Glad you like it!
@TK-ko3fg Жыл бұрын
King of SQL explanation
@DatabaseStar Жыл бұрын
Thanks!
@Kartik-vj5os2 жыл бұрын
Even after a year you are helping guys like me! Thanks for clearing my doubt
@DatabaseStar2 жыл бұрын
Thanks! Glad you found it useful.
@astorgadexterpelaez3502 Жыл бұрын
thank you! been lurking in your channel for a while now, great content sir!
@DatabaseStar Жыл бұрын
Awesome, thank you!
@metaman8662 Жыл бұрын
I'm thankful I found this video your explanation is what I needed!
@DatabaseStar Жыл бұрын
I’m glad you liked it!
@dhruvitmodi304311 ай бұрын
Nicely explain in simple terms...checked many of your videos too... I am being SQL developer, liked your work 👍
@DatabaseStar11 ай бұрын
Thanks! Glad you like the videos.
@thanzeeljalaldeen3 жыл бұрын
somethething that i needed currently for my project. thanks a lot sir
@DatabaseStar3 жыл бұрын
Glad it was helpful!
@OberynPinkViper Жыл бұрын
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.
@DatabaseStar Жыл бұрын
Glad it was helpful!
@aiasaiascon389425 күн бұрын
I have a question again - Using the Aliases is really flexible and clever - when you deal with a big database - do you use any method to keep a list of the aliases that you have created ? In case they are quite many ?
@DatabaseStar22 күн бұрын
Good question. I don't have a method to keep a list, but the aliases only exist for a specific query so we can see that they refer to right next to where they are defined.
@ExcelTutorials12 жыл бұрын
This is super helpful! Your voice is almost like listen to ASMR, lol. Nice to listen to
@DatabaseStar2 жыл бұрын
Heh thanks- I’ve been working to improve the audio on my recent videos so the older ones may sound softer.
@teenytinytoons2 жыл бұрын
It's not almost like, IT IS!!!
@quynhanhnguyenthi16862 жыл бұрын
Thank you so much for this clear explanation
@DatabaseStar2 жыл бұрын
Glad you liked it!
@RoysIdea Жыл бұрын
So how would you expand these queries if you want to order them from top to bottom, with a level or additional spaces? So start with Clair (who has no manager), followed by a manager and his/her team, etc. And include a level column.
@DatabaseStar Жыл бұрын
Good question. It depends on the database vendor, and I've written more about it here: www.databasestar.com/hierarchical-data-sql/
@slimandahra42942 жыл бұрын
your explaining is great thank u..and good luck
@DatabaseStar2 жыл бұрын
Thanks!
@chesterliu19292 жыл бұрын
At 6:38, relationship between id and manager_id is one to many which means one manager_id can have multiple employee_id to manage. However the multiple arrow sign is pointing to manager_id which should mean many manager_id can manage one employee_id. I think the arrow should be the opposite way, right?
@DatabaseStar2 жыл бұрын
Ah yes you're right! The arrow should be the other way around. Thanks for letting me know.
@offlinedie2 жыл бұрын
@@DatabaseStar Hi! Sry I think you were correct in the video, Since the foreign key is always on the many side in a EDR. Right?
@jaymo20242 жыл бұрын
04:45 the ON clause is what you need to know the rest is bloatware
@DatabaseStar2 жыл бұрын
Thanks for the comment!
@shriefabdelaziz42806 ай бұрын
wow amazing explanation thanks!!
@DatabaseStar6 ай бұрын
Glad it was helpful!
@aakash17632 жыл бұрын
Great explanation just one doubt in the ER diagram for both examples of self join why did you show 1:many relationship?
@DatabaseStar2 жыл бұрын
Good question! It's because of the way the two concepts or records are related. For example with employees and managers, an employee has one manager, but a manager can have many employees. This is a one-to-many relationship, so I've drawn it that way on the diagram. Hope that helps!
@Maria-n5g1l2 жыл бұрын
Huge thanks for such a clear explanation! Helped a lot!
@DatabaseStar2 жыл бұрын
Glad it helped!
@Mahde4 ай бұрын
Brilliant explanation
@DatabaseStar3 ай бұрын
Glad you liked it!
@BronProject2 жыл бұрын
Thank you for this!
@DatabaseStar2 жыл бұрын
Glad it helped!
@hyperborean728 ай бұрын
lovely example
@DatabaseStar8 ай бұрын
Thanks!
@ZenonMcRae3 жыл бұрын
Nice & clear
@DatabaseStar3 жыл бұрын
Thank you
@matze4896 ай бұрын
really good video
@DatabaseStar6 ай бұрын
Thanks!
@Eyenn_n2 жыл бұрын
Great content! Awesome channel!
@DatabaseStar2 жыл бұрын
Thanks so much!
@kumruorkun3947 Жыл бұрын
Very clean, thank you
@DatabaseStar Жыл бұрын
Thanks!
@oscarpalomares82822 жыл бұрын
Great explanation!
@DatabaseStar2 жыл бұрын
Thanks!
@SonAyoD7 ай бұрын
Great video
@DatabaseStar7 ай бұрын
Thanks a lot!
@AmanRaj-zo7bx11 ай бұрын
in ERD Diagram, id to manager_id relationship is One to Many, which means an employee can have multiple managers but one manager can not have multiple employees !! But it's not the case here, please clarify it.
@DatabaseStar11 ай бұрын
Good point, the employee can only have one manager but the manager can have many employees.
@AmanRaj-zo7bx11 ай бұрын
@@DatabaseStar Thanks for clarification.
@luizetulio4888 Жыл бұрын
Great video. Is it possible to use self join and a many to many relationship simultaneously or it would work only for one to many? For example if an employee has 2 or more managers...
@DatabaseStar Жыл бұрын
Good question! Yes, that is possible. Another example of using that could be if you want to capture the parents of a person, where each person could have more than one parent.
@osoriomatucurane95115 ай бұрын
The concept is easy and straitforwad, but times come you face a question with no clue that the solution comes with self join, unless you are given the schema
@DatabaseStar5 ай бұрын
Thanks! That is a good point.
@enricoroselino7557 Жыл бұрын
and what if there is a period validity of the structure (include year and month column) ? should i put it on the same table ? is it okay to have duplicate rows of ppl name?
@DatabaseStar Жыл бұрын
Good question, I think it's OK to have on the same table.It would then be an additional condition on your join, or in the WHERE clause, to check if a record falls in a certain date range.
@bouslamafathi35812 жыл бұрын
Perfect explanation thanks a lot
@DatabaseStar2 жыл бұрын
You are welcome!
@MDARUN-ph1dw3 жыл бұрын
No wonder why you are calling yourself a database star 🔥🔥🔥🔥😁
@DatabaseStar3 жыл бұрын
Thanks! The name is more for my readers and viewers to become "database stars" by learning and improving :)
@MDARUN-ph1dw3 жыл бұрын
@@DatabaseStar 😁😁🔥🔥🔥🔥🔥🔥🙏🏻🙏🏻
@balaji2035 Жыл бұрын
hi sir I have one doubt if we specify e.manager_id =m.id it will give the result only the both columns having same values right example manager_id =1 and emp_id also 1 or how does it works can you please clarify my doubt.
@DatabaseStar Жыл бұрын
Yes, if you match on e.manager_id = m.id it will show employers and their managers, which is correct.
@lehadypierrengangue41493 жыл бұрын
thanks for the content !!
@DatabaseStar3 жыл бұрын
No worries!
@humbertojesustoledovazquez58913 жыл бұрын
What a video!!! Thanks :)
@DatabaseStar3 жыл бұрын
Glad you liked it!
@michaelchiz80552 жыл бұрын
Good tutorial
@DatabaseStar2 жыл бұрын
Glad you think so!
@spaaaaace8952 Жыл бұрын
Thank you.
@DatabaseStar Жыл бұрын
You're welcome!
@newbeginning30892 жыл бұрын
Thanks. It was 👍
@DatabaseStar2 жыл бұрын
You're welcome!
@olufemiolawale3848 Жыл бұрын
Thank you sir
@DatabaseStar Жыл бұрын
You're welcome
@rural_world10 ай бұрын
Perfect
@DatabaseStar10 ай бұрын
Thanks!
@youmightdontknow4504 ай бұрын
Thank you sir
@DatabaseStar4 ай бұрын
Glad it helped!
@trytofindareasonwhy6 ай бұрын
self joins make my brain melt
@DatabaseStar6 ай бұрын
Yes they are a hard concept to understand!
@Dobby_zuul2 ай бұрын
I think your ERD should be the other way around
@DatabaseStar2 ай бұрын
Which one, the employee and manager? I think it's correct - an employee ID can be related to many other employee manager ID fields, which indicates that an employee can manage multiple other employees. Unless I am missing something?
@gauravsrivastava177 ай бұрын
❤
@DatabaseStar7 ай бұрын
Thanks
@souronion382211 ай бұрын
It is okay
@DatabaseStar11 ай бұрын
Thanks!
@haarkee93664 ай бұрын
I love you
@DatabaseStar4 ай бұрын
Haha thanks!
@poojamore056 Жыл бұрын
Hey, the employee example was good! I waited till end for another example tho.. 🥲
@DatabaseStar Жыл бұрын
Thanks! Good point, I should have included more examples.