Collection Contents Index Transact-SQL outer joins What is a subquery? pdf/chap7.pdf

User's Guide
   PART 1. Working with Databases     

CHAPTER 7. Using Subqueries


About this chapter 

When you create a query, you use WHERE and HAVING clauses to restrict the rows that the query will display.

Sometimes, the rows you select depend on information stored in more than one table. A subquery in the WHERE or HAVING clause allows you to select rows from one table according to specifications obtained from another table. Additional ways to do this can be found in .

Before your start 

This chapter assumes some knowledge of queries and the syntax of the select statement. Information about queries is located in Queries: Selecting Data from a Table.


  What is a subquery?
  Using Subqueries in the WHERE clause
  Subqueries in the HAVING clause
  Subquery comparison test
  Quantified comparison tests with ANY and ALL
  Testing set membership with IN conditions
  Existence test
  Outer references
  Subqueries and joins
  Nested subqueries
  How subqueries work

Collection Contents Index Transact-SQL outer joins What is a subquery? pdf/chap7.pdf