sql - What does this query means? -
there table named employee , it's have employee_id, manager_id, salary columns on it. query
select employee_id,salary,last_name employees m exists (select employee_id employees w (w.manager_id = m.employee_id) , w.salary>10000) order employee_id asc
what query means?
a)all managers whom salaries greater 10000
b)all managers whom have @ least 1 employee making greater 10000
if subquery returns rows @ all, exists
subquery true
, , not exists
subquery false
. example:
select column1 t1 exists (select * t2);
traditionally, exists
subquery starts select *
, begin select 5
or select column1
or @ all. mysql ignores select
list in such subquery, makes no difference.
in case option b
correct.
Comments
Post a Comment