Using group by and having in expression subqueries  Quantified predicate subqueries

Chapter 5: Subqueries: Using Queries Within Other Queries

Using distinct with expression subqueries

Subqueries that are introduced with unmodified comparison operators often include the distinct keyword to ensure the return of a single value.

For example, without distinct, this subquery fails because it returns more than one value:

select pub_name from publishers
    where pub_id =
        (select distinct pub_id
        from titles
        where pub_id  = publishers.pub_id)




Copyright © 2005. Sybase Inc. All rights reserved. Quantified predicate subqueries

View this book as PDF