Derive

Computes one or more new columns.

derive [
  {name} = {expression},
  # or
  {column},
]

Examples

PRQL

from employees
derive gross_salary = salary + payroll_tax

SQL

SELECT
  *,
  salary + payroll_tax AS gross_salary
FROM
  employees

PRQL

from employees
derive [
  gross_salary = salary + payroll_tax,
  gross_cost = gross_salary + benefits_cost
]

SQL

SELECT
  *,
  salary + payroll_tax AS gross_salary,
  salary + payroll_tax + benefits_cost AS gross_cost
FROM
  employees