Session Ready
Exercise

Row filtering with HAVING

In some cases, using HAVING, instead of WHERE, as a filter condition will produce the same results. If filtering individual or ungrouped rows then it is more efficient to use WHERE.

In this exercise, you want to know the number of players from Latin American countries playing in the 2017-2018 NBA season.

Instructions 1/2
undefined XP
  • 1
  • 2

Question

  • Copy the following query to the console and select Run Code to view the results. Why should HAVING not be used as a filter condition in this query?
SELECT Country, COUNT(*) CountOfPlayers 
FROM Players
GROUP BY Country
HAVING Country 
    IN ('Argentina','Brazil','Dominican Republic'
        ,'Puerto Rico');
Possible Answers