SQL Interview Question | How to find all levels of Employee Manager Hierarchy | Recursion

แชร์
ฝัง
  • เผยแพร่เมื่อ 5 ต.ค. 2024

ความคิดเห็น • 42

  • @LearnatKnowstar
    @LearnatKnowstar  2 ปีที่แล้ว +1

    Register at the below link to get US $100 off for Coursera Plus membership between Sep 8 - Sep 29, 2022.
    The Coursera Plus membership gets you access to unlimited courses and unlimited certifications!
    imp.i384100.net/Ke51on

  • @kristyowens2284
    @kristyowens2284 2 ปีที่แล้ว +2

    Very easy to follow. Beautifully explained!

  • @zuhebkhan6973
    @zuhebkhan6973 3 ปีที่แล้ว +1

    Thanks for all ur support in sharing knowledge... Ma'am just a request I'm new to Sql world..... Plse prepare some videos on procedure with great example as its good becoz lots of questions were asked in interviews
    Thanks in advance
    Zuheb

    • @LearnatKnowstar
      @LearnatKnowstar  3 ปีที่แล้ว

      Thank you. We are planning a video soon. Stay tuned!

  • @MuhammadZeeshan-q3l
    @MuhammadZeeshan-q3l ปีที่แล้ว +1

    we have our Mam Foqia khan, whose voice is totally like you and she is also a DBA.🤗

  • @rickrogers615
    @rickrogers615 2 ปีที่แล้ว +1

    Thank you so much for sharing this video! I really appreciate your pacing of the video where it is easy to follow. One question, how can you just out put each manager hierarchy level for all employees by column. For example, column shows all rows with the manager level of one. The second column would list all employees with the second hierarchy level and so on. I am trying to build self adjusting hierarchy level columns for use in a Power BI model where teams can change their parent team id or have new teams created or others made in active. Thank you!

    • @LearnatKnowstar
      @LearnatKnowstar  2 ปีที่แล้ว +2

      Thank you. You might need to filter on employee level to select the required columns or you might be able to use pivot for your requirements. Below is the link for sql pivot tutorial which might be useful.
      th-cam.com/video/uT_Z2VP2Z24/w-d-xo.html

  • @balajiveerasingam3602
    @balajiveerasingam3602 3 ปีที่แล้ว +1

    Thanks for sharing your knowledge. It help us really

  • @mummz3371
    @mummz3371 2 ปีที่แล้ว

    Thank you for your video and the great explanation. I really enjoy watching your videos❤️

  • @vishwas22khare
    @vishwas22khare 2 ปีที่แล้ว +2

    Very nice explanation

  • @arnohoedelmans
    @arnohoedelmans 2 ปีที่แล้ว

    Hi can you do a video explaining how to get the hierarchy structure for every employee on one row?
    Thank you very much!

  • @aditidutt6328
    @aditidutt6328 2 ปีที่แล้ว +1

    Thanks for this video, How can we find employees who are not having any reportee(parents having no child)

    • @LearnatKnowstar
      @LearnatKnowstar  2 ปีที่แล้ว

      you can do a left join on a.empid = a1.mgrid and filter where mgrid is null.

  • @Beyondhorizons-i5z
    @Beyondhorizons-i5z 3 ปีที่แล้ว +1

    Awesome explanation

  • @gobind289
    @gobind289 2 ปีที่แล้ว

    There is a concept called heirarchyId. Which is more optimized way for large data set. Please make a video on this

    • @LearnatKnowstar
      @LearnatKnowstar  2 ปีที่แล้ว

      Thank you for mentioning this concept. Video coming in next few weeks🙏

  • @jojog2624
    @jojog2624 2 ปีที่แล้ว +1

    Nice tutorials!
    Could you share your demo table data if possible, AdventureWorks sample data I downloaded from microsoft also have difference from yours...

    • @LearnatKnowstar
      @LearnatKnowstar  2 ปีที่แล้ว

      Thank you. Will try to share the DDLs in upcoming videos!

  • @svenkatjkn
    @svenkatjkn 2 ปีที่แล้ว

    Beautifully explained!

  • @asholkkumar4685
    @asholkkumar4685 2 ปีที่แล้ว

    Query optimization explain in further videos.thanks for ur great time.

  • @saurabhpandey1064
    @saurabhpandey1064 2 ปีที่แล้ว

    where can we find the database for practicing this ? can you please attach a link .
    Your videos are very helpful in preparation.

  • @hv0032113
    @hv0032113 3 ปีที่แล้ว

    Thank you for the great explanation.

  • @GDchanaka-he7qr
    @GDchanaka-he7qr ปีที่แล้ว

    good explanation. Thank you.

  • @swapnaguthi8413
    @swapnaguthi8413 3 ปีที่แล้ว

    Nice explanation.. Thanks for sharing

  • @satishsharmaphotography
    @satishsharmaphotography ปีที่แล้ว

    hey, ive been trying to solve this, for a table containing 2600 employees. but in my case, theere is no emp id with null manager id. what to do in that case.

  • @_SanchitaPatil
    @_SanchitaPatil ปีที่แล้ว

    can we solve it using rank or denserank?

  • @khushik8994
    @khushik8994 2 ปีที่แล้ว

    Thank u so much for this video. I have a doubt. In 1st query of CTE, we are mentioning condition where managerID is null then how it is running for all managerID which is not null. Could you please let me know where my understanding is wrong

    • @LearnatKnowstar
      @LearnatKnowstar  2 ปีที่แล้ว +1

      The second part of the query after UNION ALL fetches the employees where manager id is not null. This is an example of recursive query.
      This is another tutorial based on SQL recursion. You might find it helpful.
      th-cam.com/video/d6OL9eDUhCE/w-d-xo.html
      We will plan to post a separate tutorial explaining recursive queries. Thank you.

    • @khushik8994
      @khushik8994 2 ปีที่แล้ว

      @@LearnatKnowstar Thank u soo much for the detailed explanation...

  • @johnalfredbulado5272
    @johnalfredbulado5272 3 ปีที่แล้ว

    can you show your table ? thank you

  • @lalithroy
    @lalithroy 3 ปีที่แล้ว

    Hi Mam,
    Where can i get the data to practice. Or you can share the SQL script.

  • @inhlam5909
    @inhlam5909 2 ปีที่แล้ว +1

    Level: Hard.

  • @Adinasa2
    @Adinasa2 11 หลายเดือนก่อน

    Can someone do this in python