Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
12. Summary


Good job! That query was really challenging!

It's time to wrap things up. What have we learned in this part?

  • It's impossible to put a CTE inside another CTE. However, each CTE can use previously-defined CTEs in the FROM clause.
  • Nested CTEs can be used to compute aggregate functions on a few levels.
  • If you need more than just the aggregate result in the outer query, you can use a small subquery.
  • CTEs can also be used to compare two (or more) groups of rows.

Are you ready for a short quiz?


Click Next exercise to continue.