O'Reilly logo

Oracle SQL, A Beginner's Tutorial, Second Edition by Djoni Darmawikarta

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 6

Subqueries

A subquery is a query nested within another query. The containing query is called an outer query. A subquery in turn can have a nested query, making it a multiply nested query.

This chapter discusses subqueries in detail.

Single-Row Subqueries

A single-row subquery is a subquery that returns a single value. A single-row subquery can be placed in the WHERE clause of an outer query. The return value of the subquery is compared with a column of the outer query using one of the comparison operators. (Comparison operators were discussed in Chapter 2, �Basic Queries�)

For example, the query in Listing 6.1 contains a single-row subquery that returns the highest sale price recorded for a product. The outer query returns all products ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required