Syntax
A summary of PRQL syntax:
| Syntax | Usage | Example |
|---|---|---|
| |
Pipelines | from employees | select first_name |
= |
Assigns & Aliases | from e = employees derive total = (sum salary) |
: |
Named args & Parameters | interp low:0 1600 sat_score |
[] |
Lists | select [id, amount] |
! && || == +, etc |
Expressions & Operators | filter a == b + c || d >= e |
() |
Parentheses | derive celsius = (fahrenheit - 32) / 1.8 |
‘’, “” |
Strings | derive name = ‘Mary’ |
`</code></td><td><a href="$90360498d63ac010.md">Quoted identifiers</a></td><td><code>selectfirst name` |
||
# |
Comments | # A comment |
@ |
Dates & Times | @2021-01-01 |
== |
Self-equality in join | join s=salaries [==id] |
-> |
Function definitions | func add a b -> a + b |
=> |
Case statement | case [a==1 => c, a==2 => d ] |
+/- |
Sort order | sort [-amount, +date] |
?? |
Coalesce | amount ?? 0 |
