0

When do you use "Where Exists" and when do you use "IN" in a subquery? Is the "where exists" clause associated consider a correlated query?

I'm struggling to understand the different types of sub queries and when yo use them. When would I use a sub query in Select, From, or Where.

Also, why use a sub query that perform the same function as joins?

Select *
From t_employees as e 
Where EXISTS(
    Select *
    From t_dept_manager as d
    Where e.emp_no = d.emp_no);

VS

Select *
From t_employees
Where emp_no IN (
   Select emp_no
   From t_dept_manager);
MikeJ
  • 1
  • 1

0 Answers0