Chapter 14. Using Subqueries to Define Unknown Data

During this hour, you are presented with the concept of using subqueries to return results from a database query more effectively.

The highlights of this hour include:

  • What a subquery is

  • The justifications of using subqueries

  • Examples of subqueries in regular database queries

  • Using subqueries with data manipulation commands

  • Embedded subqueries

What Is a Subquery?

A subquery, also known as a nested query, is a query embedded within the WHERE clause of another query to further restrict data returned by the query. A subquery is used to return data that will be used in the main query as a condition to further restrict the data to be retrieved. Subqueries are used with the SELECT, INSERT, UPDATE, and DELETE ...

Get Sams Teach Yourself SQL in 24 Hours, Fourth Edition 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.