What does `WITHIN GROUP (ORDER BY col)` do with ordered-set aggregate functions like `PERCENTILE_CONT()`?

Advanced SQL Developer Medium

Advanced SQL Developer — Medium

What does `WITHIN GROUP (ORDER BY col)` do with ordered-set aggregate functions like `PERCENTILE_CONT()`?

Key points

  • WITHIN GROUP (ORDER BY col) is used with ordered-set aggregate functions
  • It determines the order of rows for computing order-dependent aggregates
  • Helps calculate percentiles by interpolating between sorted values
  • Not used for filtering rows within a specific group range

Ready to go further?

Related questions