Last answered:

22 May 2023

Posted on:

20 May 2023

0

Another way to solve the problem in this lecture

Dear 365datascience team,


Somehow I came across a following solution(exactly the same) to the question taught in this lecture,

but not sure about whether it's a self-join or not? 

Besides, since there are so many solutions to this question, I wonder any benefits to use self-join? Thanks!


SELECT
    e1.*
FROM
    Employees.emp_manager AS e1
    INNER JOIN
        Employees.emp_manager AS e2
        ON
            e1.emp_no = e2.emp_no
WHERE
    e1.emp_no
        IN    (
            SELECT
                e2.manager_no
            FROM
                Employees.emp_manager AS e2
        )
;

1 answers ( 0 marked as helpful)
Instructor
Posted on:

22 May 2023

1

Hi Chun!
Thanks for reaching out.


Yes, your solution is also valid. Bravo!


Hope this helps.
Best,
Tsvetelin

Submit an answer