Hi ALL,
TRIM(ename)=
CASE
WHEN(SELECT COUNT(e2.ename)
FROM emp e2
WHERE e2.empno = e.empno
) > 0
THEN e2.ename
ELSE 'ALL'
END
TRIM(ename)=
CASE
WHEN exists (SELECT *
FROM emp e2
WHERE e2.empno = e.empno
)
THEN e2.ename
ELSE 'ALL'
END
In above two scenarios which one is best to use performance wise. I have tested exists condition, it tooks less time rather than Count() function.
but in some articles wrote that exist will do full table scan. So i am in confused which one is best..?
Suggestions please...