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 ? | 1 Yes | 0 No |
Post New Answer View All Answers
What are the different types of base tables?
Discuss about db2 bind?
What is the latest version of ibm db2?
How to access db2 tables in mainframe?
What is dpf in db2?
before altering a table is it necessary to lock ? if lock what is it ? how to do ? ifi want to lock a table what is that command ?
Explain about rct.
How many types of page locks can be held in db2?
What is runstats utility in db2?
What are the full forms of spufi and dclgen and why are they used?
What is the use of value function?
Mention a credible reason why select* is never given preference in an sql program that has been embedded.
is it compulsory commitment control in journal?
Which isolation level provides maximum concurrency?
If I have a view which is a join of two or more tables, can this view be updateable?