What does the following query pattern accomplish? SELECT e.* FROM employees e LEFT JOIN managers m ON e.id = m.employee_id WHERE m.employee_id IS NULL

SQL Fundamentals Hard

SQL Fundamentals — Hard

What does the following query pattern accomplish? SELECT e.* FROM employees e LEFT JOIN managers m ON e.id = m.employee_id WHERE m.employee_id IS NULL

Key points

  • The query combines the employees and managers tables using a LEFT JOIN
  • It filters out rows where the employee_id in the managers table is NULL
  • The result is a list of employees who do not have a corresponding entry in the managers table

Ready to go further?

Related questions