Skip to content
Theory · Aggregates and GROUP BY · lesson 5 of 10

HAVING and WHERE

Often you need not all groups but only some. For example, the coffee shop's owner wants to see the categories that have more than two items: small categories do not interest him right now.

In this lesson

  • HAVING filters groups
  • WHERE filters rows before grouping
  • WHERE and HAVING together
  • What goes where
  • Common mistake
  • Key points