SQL queries that use
EXISTS subqueries are inefficient because the subquery is re-run for every row in the outer query’s table. There
are more efficient ways to write most queries, ways that do not use the
Noncompliant Code Example
FROM employee e
WHERE EXISTS (SELECT * FROM department d WHERE e.department_id = d.id AND d.name = 'Marketing')
FROM employee e INNER JOIN department d
ON e.department_id = d.id AND d.name = 'Marketing'