Super learner
This user is a Super Learner. To become a Super Learner, you need to reach Level 8.
Last answered:

21 Jun 2023

Posted on:

20 Jun 2023

0

Other Solutions

Here are three solution that worked for me, I found one mentioned above


# Using distinct ##

##############

SELECT distinct ee.*
FROM emp_manager ee
JOIN emp_manager eM ON ee.emp_no = eM.manager_no;


# Using Subqueries nested in WHERE  ##

###############################

SELECT ee.*
FROM emp_manager ee 
WHERE ee.emp_no IN  (SELECT distinct manager_no FROM emp_manager);


##  Using GROUP BY ############

############################

SELECT ee.emp_no, eM.manager_no
FROM emp_manager ee
JOIN emp_manager eM ON ee.emp_no = eM.manager_no
GROUP BY ee.emp_no;

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

21 Jun 2023

0

Hi Sahar!
Thanks for reaching out.


Yes, these are alternatives solutions. The second one contains 4 rows which are two by two the same.


Hope this helps.
Best,
Tsvetelin

Submit an answer