Chapter 4. Subqueries

SQL supports writing queries within queries, or nesting queries. The outermost query is a query whose result set is returned to the caller and is known as the outer query. The inner query is a query whose result is used by the outer query and is known as a subquery. The inner query acts in place of an expression that is based on constants or variables and is evaluated at run time. Unlike using constants in your expressions, the result of a subquery may change because of changes in the queried tables. By using subqueries you avoid the need for separate steps in your solutions ...

Get Microsoft® SQL Server® 2008 T-SQL Fundamentals now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.