| Sub-query | Co-related sub-query |
| A sub-query is executed once for the parent Query | Where as co-related sub-query is executed once for each row of the parent query. |
| Example: Select * from emp where deptno in (select deptno from dept); | Example: Select a.* from emp e where sal >= (select avg(sal) from emp a where a.deptno=e.deptno group by a.deptno); |
No comments:
Post a Comment