Syntax
A summary of PRQL syntax:
Syntax | Usage | Example |
---|---|---|
| | Pipelines | from employees | select first_name |
= | Assigns | from e = employees derive total = (sum salary) |
: | Named args & parameters | interp low:0 1600 sat_score |
{} | Tuples | {id, false, total = 3} |
[] | Arrays | [1, 4, 3, 4] |
! && == + | Operations | filter a == b + c || d >= e |
() | Parentheses | derive celsius = (fahrenheit - 32) / 1.8 |
‘’ , “” | Strings | derive name = ‘Mary’ |
| ||
# | Comments | # A comment |
@ | Dates & times | @2021-01-01 |
== | Self-equality in join | join s=salaries (==id) |
-> | Function definitions | let add = a b -> a + b |
=> | Case statement | case {a==1 => c, a==2 => d } |
+ /- | Sort order | sort {-amount, +date} |
?? | Coalesce | amount ?? 0 |