Back to Prql

Syntax

web/book/src/reference/syntax/README.md

0.13.124.0 KB
Original Source

Syntax

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? -->
SyntaxUsageExample
<code>|</code>Pipelines<code>from employees | select first_name</code>
=Assignsfrom e = employees
derive total = (sum salary)
:Named args & parametersinterp low:0 1600 sat_score
{}Tuples{id, false, total = 3}
[]Arrays[1, 4, 3, 4]
+,!,&&,==, etcOperators<code>filter a == b + c || d >= e</code>
()Parenthesesderive celsius = (fht - 32) / 1.8
\Line wrap<code>1 + 2 + 3 +</code>
<code>\ 4 + 5</code>
1,100_000,5e10Numbersderive { huge = 5e10 * 10_000 }
'',""Stringsderive name = 'Mary'
true,falseBooleansderive { Col1 = true }
nullNullfilter ( name != null )
@Dates & times@2021-01-01
` `Quoted identifiersselect `first name`
#Comments# A comment
==Self-equality in joinjoin s=salaries (==id)
->Function definitionslet add = a b -> a + b
=>Case statementcase [a==1 => c, a==2 => d]
+,-Sort ordersort {-amount, +date}
??Coalesceamount ?? 0
<!-- markdownlint-enable MD033 -->