Scenario: In a database with employee records, you need to retrieve the names of all employees and their respective managers. The employee table has a "ManagerID" column that relates employees to their managers. Which SQL operation can you use to achieve this?

  • INNER JOIN
  • LEFT JOIN
  • RIGHT JOIN
  • SELF JOIN
A SELF JOIN is a regular join but with a table being joined to itself. In this scenario, you can use a SELF JOIN on the employee table, matching the ManagerID in the table to the ID of another employee to retrieve the names of all employees and their respective managers.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *