web/book/src/reference/syntax/README.md
A summary of PRQL syntax:
<!-- markdownlint-disable MD033 — the `|` characters need to be escaped, and surrounded with tags rather than backticks --> <!-- I can't seem to get "Quoted identifies" to work without a space between the backticks. VS Code will preview ` `` ` correctly, but not mdbook --> <!-- TODO: assigns links to select, aliases to join, potentially we should have explicit sections for them? -->| Syntax | Usage | Example |
|---|---|---|
| <code>|</code> | Pipelines | <code>from employees | select first_name</code> |
= | 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 | <code>filter a == b + c || d >= e</code> |
() | Parentheses | derive celsius = (fht - 32) / 1.8 |
\ | Line wrap | <code>1 + 2 + 3 +</code> |
| <code>\ 4 + 5</code> | ||
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 |
` ` | Quoted identifiers | select `first name` |
# | 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 |