Skip to content
CodeKruPro

A WHERE condition that undoes a LEFT JOIN

QuizMedium-Hard

The Support department has no employees. Does Support appear in the result of this query?

SELECT d.name, e.name
FROM departments d
LEFT JOIN employees e ON e.dept_id = d.id
WHERE e.salary > 60000;
  • No: for Support, e.salary is NULL, so the WHERE condition is not true and the row is removed
  • Yes, because a LEFT JOIN always keeps every department
  • Yes, with NULL as the employee name
  • The query is an error

This question is part of Pro+

Pro+ opens every question in Interview Prep and the mock interview. Every article and the first 2 questions of each topic stay free. Hands-on Selenium and API tasks follow their course lesson's own lock.

See Pro+

Already have Pro+? Sign in