OracleAppsDNA

Backward ‘Like’ Statement

 
SELECT e.empno,
  e.ename      ,
  e.deptno     ,
  d.dname
   FROM emp e,
  dept d
  WHERE 1   = 1
AND e.deptno=d.deptno;

The above query gives the same result when WHERE condition e.deptno=d.deptno is replaced with d.deptno= e.deptno.

SELECT *
   FROM emp
  WHERE ename LIKE 'SMITH';

In the same way, will the above query work if we replace ename LIKE ‘SMITH’ with ‘SMITH’ LIKE ename ???

SELECT *
   FROM emp
  WHERE 'SMITH' LIKE ename;

Interestingly it works!! But its taking more time when we experiment on real time tables like ‘per_all_people_f’ as it contains huge number of records.

Exit mobile version