Difference between sub query and nested query ?

Answer Posted / lakshmi

Correlated subquery runs once for each row selected by the
outer query. It contains a reference to a value from the
row selected by the outer query.
Nested subquery runs only once for the entire nesting
(outer) query. It does not contain any reference to the
outer query row.
For example,
Correlated Subquery:
select e1.empname, e1.basicsal, e1.deptno from emp e1 where
e1.basicsal = (select max(basicsal) from emp e2 where
e2.deptno = e1.deptno)
Nested Subquery:
select empname, basicsal, deptno from emp where (deptno,
basicsal) in (select deptno, max(basicsal) from emp group
by deptno)

Is This Answer Correct ?    96 Yes 11 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to list all user accounts in oracle?

620


How to create an oracle database manually?

579


How to delete a user account in oracle?

554


How to convert csv to table in oracle?

533


What is a data dictionary and how can it be created?

621






How many types of cluster table in Oracle?

583


Is truncate autocommit in oracle?

645


How to bring a tablespace online?

524


Is it possible to insert comments into sql statements return in the data model editor ?

2074


Difference between varchar and varchar2 data types?

671


How to do paging with oracle?

580


why dont we assign not null constraint as table level constraint.

2261


What operating systems are supported by oracle database 10g xe?

588


How to do clean up if create database failed?

578


Briefly explain what is literal? Give an example where it can be used?

548