Self Join | Ep-10 | Top 20 SQL Interview Questions | GeeksforGeeks

Поділитися
Вставка
  • Опубліковано 26 лис 2024

КОМЕНТАРІ • 25

  • @dreamGaming0399
    @dreamGaming0399 Рік тому +9

    I think there is a mistake at 5:06 where in the select clause you have mentioned e2.sal which is managers salary... Instead of e1.sal
    That is 2975 is the manager (jones) salary. Which is less than scott's and Ford's salary.

    • @RealSlimShady-um6gf
      @RealSlimShady-um6gf 8 місяців тому

      Must be typo there he must add e1.sal for employee salary and check for manager salary. Same issue with hiredate

  • @Shareit_to_growit
    @Shareit_to_growit 2 роки тому +1

    Another example we can consider as "select employee name and employee id who are having atleast 2 employees directly reporting to them"

    • @aakashjadhav6242
      @aakashjadhav6242 Рік тому

      This was asked to me in recent interview, I could not answer this and I failed

    • @abhinaygupta8243
      @abhinaygupta8243 6 місяців тому

      @@aakashjadhav6242 select ename
      from (select ename, count(*) over (partition by mgr) cnt from emp order by cnt)
      where cnt >2;

  • @jayakavya29
    @jayakavya29 3 роки тому +1

    👏🏻👏🏻👏🏻👏🏻👏🏻very nice explanation....

  • @ShubhamMahawar_Dancer_Actor
    @ShubhamMahawar_Dancer_Actor 3 роки тому +4

    Yes he has printed the salary and hiredate of manager not the employees he might said wrongly cz e2.sal and e2.hiredate

  • @vishalgaurav8222
    @vishalgaurav8222 5 років тому +4

    here all the 7 employees and their managers' name can be displayed through the query:select a.ename,b.ename as mgrname from emp a left join emp b on a.mgrid=b.empid

    • @piyushmanglani6471
      @piyushmanglani6471 2 роки тому +4

      The point of this video is why there is a self join. Not finding out the most optimal way to get what is needed. So my point is your comment is useless.

  • @satyamsamala466
    @satyamsamala466 Рік тому

    Thanks for the video...

  • @hemantbhatt1486
    @hemantbhatt1486 3 роки тому +5

    Explaining good PLEASE SLOOOOOOW SLOOOW DOWN TALKING DUDE

  • @malipeddiprathishreddy288
    @malipeddiprathishreddy288 3 роки тому +5

    AT 5:06 you said the salary of scot and ford is 2975 but it is Jones salary and the salary of scot and ford is 3000, then the employee scot and ford having a salary of 3000 which is greater than the manager jones. So, please check it.

    • @ShubhamMahawar_Dancer_Actor
      @ShubhamMahawar_Dancer_Actor 3 роки тому +2

      Yes he has printed the salary and hiredate of manager not the employees he might said wrongly cz e2.sal and e2.hiredate

  • @jaswindersingh-zh8qr
    @jaswindersingh-zh8qr 3 роки тому

    thanks bro

  • @harbanskaur4240
    @harbanskaur4240 3 роки тому +6

    Confusing

  • @vishnujatav6329
    @vishnujatav6329 2 роки тому

    You are using WHERE clause, and you caption the video as SELF JOIN??

  • @sridhar6358
    @sridhar6358 3 роки тому +1

    can we have e1.sal inplace of e2.sal in this explanation

  • @nikitabhattad9940
    @nikitabhattad9940 4 роки тому +1

    Display country name,city,and number of departments where department has more than 5employees

  • @nikitabhattad9940
    @nikitabhattad9940 4 роки тому

    This question is from hr schema

  • @ramaraja6600
    @ramaraja6600 2 роки тому

    Video is blurry

  • @kupendrapola7186
    @kupendrapola7186 3 роки тому +1

    this is the best explanation for self join I have ever seen