I have a schema of emp table defined as emp ( empno ,ename ,job ,mgr ,hiredate) and I have to evaluate the query for the problem statement :
List the employees who are senior to most recently hired employee working under king.
I wrote the query as :
select hiredate from emp where hiredate < ANY
( select e.hiredate from emp e where e.mgr= (select e.empno from emp e
where e.ename='KING') order by hiredate desc )
Use max function instead-
select hiredate from emp where hiredate < ( select max(hiredate) from emp where mgr= (select e.empno from emp e where e.ename='KING'));