Temporary Data Store Tutorial – Part 3: Introduction to Subqueries


By:
Overview

A subquery is a select statement embedded in another SQL statement, such as a select, insert, delete, or update statement.  The set of value(s) returned by the inner select statement are passed to the outer SQL statement.  The inner select statement is always embraced in parentheses.  The result set from the inner select statement is an example of a temporary data store.  Subqueries can reside at many different places within an outer select statement.  This tutorial section introduces the topic of subqueries by presenting easy-to-follow code samples that demonstrate the use of subqueries in where clauses, select list items, and with insert, update, and delete statements.  Two subsequent sections drill down on more advanced issues pertaining to subqueries.

In this section we will cover the following topics:

  • Using a subquery in a select statements where clause
  • Using a subquery as a select list item
  • Using a subquery in insert, update, and delete statements
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