Chapter 5
Complex Queries andJoin Queries
5.1 Selection Queries with DISTINCT
Chapter 3 covered basic SQL queries using the keywords SELECT and WHERE. Chapter 4 introduced ordering, calculating, and grouping in queries. To keep the presentation of the new material in Chapter 4 straightforward, the examples did not include some of the features that had been introduced earlier in Chapter 3. Not all features of SQL can be combined in the same query, but the majority can. For example, you can easily use the keyword DISTINCT when writing a query that uses WHERE.
Suppose you wanted to find the distinct discountPrice values of movies that have won Academy Awards. Example Query 5-1 shows this query.
The complete output of Example Query 5-1 is ...
Get The SQL Programming Language 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.