What is a sub query and co-related sub query?

Questions by jayababuhrd

Showing Answers 1 - 3 of 3 Answers

indira

  • Feb 1st, 2012
 

Sub query: A sub query is executed once for the parent statement.

Correlated Sub query: Correlated sub query 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.

Example:
Select e1.empname, e1.basicsal, e1.deptno
From emp e1
Where e1.basicsal = (Select max(basicsal) From emp e2 Where e2.deptno = e1.deptno)

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions