Developer community
+1 vote
140 views
What do you mean by Correlated subquery?
asked by Sr Member (1.5k points) 8 23 37 | 140 views

1 Answer

0 votes
Subqueries, or nested queries, are used to bring back a set of rows to be used by the parent query. Depending on how the subquery is written, it can be executed once for the parent query or it can be executed once for each row returned by the parent query. If the subquery is executed for each row of the parent, this is called a correlated subquery.

    A correlated subquery can be easily identified if it contains any references to the parent subquery columns in its WHERE clause. Columns from the subquery cannot be referenced anywhere else in the parent query. The following example demonstrates a non-correlated subquery.

 E.g. Select * From CUST Where '10/03/1990' IN (Select ODATE From ORDER Where CUST.CNUM = ORDER.CNUM)
answered by Geek (15.7k points) 5 9 21

Related questions

+1 vote
1 answer
asked by steve Sr Member (1.5k points) 8 23 37 | 63 views
+1 vote
1 answer
asked by steve Sr Member (1.5k points) 8 23 37 | 176 views
+1 vote
1 answer
asked by anonymous | 91 views
0 votes
1 answer
0 votes
1 answer
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

Categories


C Books Guide and List
C++ Books Guide and List
Best Java Books

3.8k questions

4k answers

117 comments

10.7k users

3,754 questions
4,046 answers
117 comments
10,709 users