語法
PRQL 語法摘要:
| 語法 | 用法 | 範例 |
|---|---|---|
| | 管道 | from employees | select first_name |
= | 指派 | from e = employees derive total = (sum salary) |
: | 具名引數和參數 | interp low:0 1600 sat_score |
{} | 值組 | {id, false, total = 3} |
[] | 陣列 | [1, 4, 3, 4] |
+、!、&&、== 等 | 運算子 | filter a == b + c || d >= e |
() | 括號 | derive celsius = (fht - 32) / 1.8 |
\ | 換行 | 1 + 2 + 3 +\ 4 + 5 |
1、100_000、5e10 | 數字 | derive { huge = 5e10 * 10_000 } |
''、"" | 字串 | derive name = 'Mary' |
true、false | 布林值 | derive { Col1 = true } |
null | Null | filter ( name != null ) |
@ | 日期和時間 | @2021-01-01 |
` ` | 引用的識別符號 | select `first name` |
# | 註釋 | # A comment |
== | join 中的自相等 | join s=salaries (==id) |
-> | 函式定義 | let add = a b -> a + b |
=> | Case 語句 | case [a==1 => c, a==2 => d] |
+、- | 排序順序 | sort {-amount, +date} |
?? | 合併 | amount ?? 0 |