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 delete a column in an existing table?

595


What is connection pool in oracle?

560


What are the benefits of ordbms?

620


Oracle

1856


Database crashes. Corruption is found scattered among the file system neither of your doing nor of Oracles. What database recovery options are available? Database is in archive log mode.

1539






how do we code triggers , store procedure , Performance tuning and indexing in a Java Project? Pls kindly get me the perfect answer with the code for each....thank you in advance............pls any body kindly help me soon as possible....

1594


What is Segment Advisor in Oracle?

671


What is the difference between pre-select and pre-query?

621


How to save query output to a local file?

563


What is coalesce function?

577


How to commit the current transaction in oracle?

578


How to define an anonymous procedure with variables?

545


What is hash cluster in oracle?

596


How to create a stored procedure in oracle?

577


Difference between inner join vs where ?

613