O'Reilly logo

SQL: Visual QuickStart Guide by Chris Fehily

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

Qualifying Column Names in Subqueries

Recall from “Qualifying Column Names” in Chapter 7 that you can qualify a column name explicitly with a table name to identify the column unambiguously. In statements that contain subqueries, column names are qualified implicitly by the table referenced in the FROM clause at the same nesting level.

In Listing 8.15a, for example, the column names are qualified implicitly, meaning:

  • The column pub_id in the outer query’s WHERE clause is qualified implicitly by the table publishers in the outer query’s FROM clause.

  • The column pub_id in the subquery’s SELECT clause is qualified implicitly by the table titles in the subquery’s FROM clause.

Listing 8.15b shows Listing 8.15a with explicit qualifiers. See Figure 8.15 ...

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