Temporary Data Store Tutorial – Part 4: Uncorrelated and Correlated Subqueries


By:
Overview

A correlated subquery is a special kind of temporary data store in which the result set for an inner query depends on the current row of its outer query.  In contrast, an uncorrelated subquery has the same result set no matter what row is current in its outer query.  This section reviews a couple of correlated subquery examples and compares them to alternative formulations based on joins for derived tables.  The comparisons rely on an examination of the result sets as well as the execution plans for the alternative formulations.  These comparisons shed light on the efficiency of uncorrelated subqueries versus joins between derived tables.  The next temporary data store tutorial section will focus more thoroughly on derived tables.

In this section we will cover the following topics:

  • Revisit of correlated subquery as a select list item
  • Correlated and uncorrelated subqueries in where clauses
Additional Information

Here are some links to resources that you may find useful to help you grow your understanding of content from this section of the tutorial.






Comments For This Article

















get free sql tips
agree to terms