Inner Transforms

Parentheses are also used for transforms (such as group and window) that pass their result to an “inner transform”. The example below applies the aggregate pipeline to each group of unique title and country values:

PRQL

  1. from employees
  2. group [title, country] (
  3. aggregate [
  4. average salary,
  5. ct = count
  6. ]
  7. )

SQL

  1. SELECT
  2. title,
  3. country,
  4. AVG(salary),
  5. COUNT(*) AS ct
  6. FROM
  7. employees
  8. GROUP BY
  9. title,
  10. country