Skip to content
Theory · Subqueries · lesson 7 of 11

Subquery in FROM

How many orders does one customer place on average? To answer, you need two steps: first count each customer's orders, then average those numbers. The first step is GROUP BY with count(*), the second is avg over the result.

In this lesson

  • A table from a subquery
  • A subquery in FROM in a join
  • Common mistake
  • Key points