386 Chapter 8: Using Subqueries to Solve Problems
|INSIDE THE EXAM|
Subqueries can be used to generate values for the select list of a query to generate an inline view to be used in the FROM clause, in the WHERE clause, and in the HAVING clause. When used in the WHERE or HAVING clauses, single-row subqueries can be used with these comparison operators: =, >, >=, <, <=, <>. Multiple-row subqueries can be used with these comparison operators: IN, NOT IN, ANY, ALL.
Describe the Types of Problems That the Subqueries Can Solve
❑ Selecting rows from a table with a condition that depends on the data within the table can be implemented with a subquery.
❑ Single-row subqueries return one row, possibly with several columns.❑ A scalar subquery returns a single value; it is a single-row, single-column subquery.
❑ A correlated subquery is executed once for every row in the outer query.