O'Reilly logo

SQL Queries for Mere Mortals: A Hands-On Guide to Data Manipulation in SQL, Second Edition by Michael J. Hernandez, John L. Viescas

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

A New Meaning of “Focus Groups”

You now know that once you’ve gathered your information into groups of rows, you can request the MIN, MAX, AVG, SUM, or COUNT of all the values in each group. Suppose you want to refine further the final result set—to focus the groups—by testing one of the aggregate values. Let’s take a look at a simple request.

“Show me the entertainer groups that play in a jazz style and have more than three members.”

Doesn’t sound too difficult, does it? Figure 14-1 shows the tables needed to solve this request.

Figure 14-1. The tables needed to figure out which entertainers play jazz and also have more than three members

Note

We again use the “Request/Translation/Clean Up/SQL” technique introduced ...

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