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] |
+ ,! ,&& ,== , etc | Operators | filter a == b + c || d >= e |
() | Parentheses | derive celsius = (fht - 32) / 1.8 |
\ | Line wrap | 1 + 2 + 3 + \ 4 + 5 |
1 ,100_000 ,5e10 | Numbers | derive { huge = 5e10 * 10_000 } |
‘’ ,“” | Strings | derive name = ‘Mary’ |
true ,false | Booleans | derive { Col1 = true } |
null | Null | filter ( name != null ) |
@ | Dates & times | @2021-01-01 |
| ||
# | Comments | # A comment |
== | 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 |