Could anyone clearly explain the diference between sub
query and correlated sub query?
Answer Posted / sriram
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)
Please let me know if I am wrong...............
Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
How can tablespace be moved to another dasd volume that is allocated for that tablespace?
What is null value in db2?
What is database reorganization?
How to test SQL -911 error while developing COB-DB2 program
How to find the number of rows in a db2 table?
How does cobol compile db2 program?
Why db2 is called db2?
Name the various locking levels available?
What is db2?
How do you pull up a query which was previously saved in qmf?
What is the result of open cursor statement?
What is with ur in db2?
What are the various isolation levels possible?
List out the data types available.
Explain correlated sub-queries.