Skip to content

Commit

Permalink
Merge pull request #5669 from cockroachdb/window-frame-definition
Browse files Browse the repository at this point in the history
Window frame docs
  • Loading branch information
ericharmeling authored Oct 29, 2019
2 parents 6369a3f + 056943a commit 78e4399
Show file tree
Hide file tree
Showing 4 changed files with 216 additions and 204 deletions.
28 changes: 28 additions & 0 deletions _includes/v19.2/sql/diagrams/opt_frame_clause.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<div><svg width="633" height="191">
<polygon points="9 17 1 13 1 21"></polygon>
<polygon points="17 17 9 13 9 21"></polygon>
<rect x="51" y="3" width="66" height="32" rx="10"></rect>
<rect x="49" y="1" width="66" height="32" class="terminal" rx="10"></rect>
<text class="terminal" x="59" y="21">RANGE</text>
<rect x="51" y="47" width="62" height="32" rx="10"></rect>
<rect x="49" y="45" width="62" height="32" class="terminal" rx="10"></rect>
<text class="terminal" x="59" y="65">ROWS</text>
<rect x="51" y="91" width="78" height="32" rx="10"></rect>
<rect x="49" y="89" width="78" height="32" class="terminal" rx="10"></rect>
<text class="terminal" x="59" y="109">GROUPS</text>
<rect x="189" y="35" width="86" height="32" rx="10"></rect>
<rect x="187" y="33" width="86" height="32" class="terminal" rx="10"></rect>
<text class="terminal" x="197" y="53">BETWEEN</text><a xlink:href="sql-grammar.html#frame_bound" xlink:title="frame_bound">
<rect x="295" y="35" width="104" height="32"></rect>
<rect x="293" y="33" width="104" height="32" class="nonterminal"></rect>
<text class="nonterminal" x="303" y="53">frame_bound</text></a><rect x="419" y="35" width="48" height="32" rx="10"></rect>
<rect x="417" y="33" width="48" height="32" class="terminal" rx="10"></rect>
<text class="terminal" x="427" y="53">AND</text><a xlink:href="sql-grammar.html#frame_bound" xlink:title="frame_bound">
<rect x="507" y="3" width="104" height="32"></rect>
<rect x="505" y="1" width="104" height="32" class="nonterminal"></rect>
<text class="nonterminal" x="515" y="21">frame_bound</text></a><a xlink:href="sql-grammar.html#opt_frame_exclusion" xlink:title="opt_frame_exclusion">
<rect x="453" y="157" width="152" height="32"></rect>
<rect x="451" y="155" width="152" height="32" class="nonterminal"></rect>
<text class="nonterminal" x="461" y="175">opt_frame_exclusion</text></a><path class="line" d="m17 17 h2 m20 0 h10 m66 0 h10 m0 0 h12 m-118 0 h20 m98 0 h20 m-138 0 q10 0 10 10 m118 0 q0 -10 10 -10 m-128 10 v24 m118 0 v-24 m-118 24 q0 10 10 10 m98 0 q10 0 10 -10 m-108 10 h10 m62 0 h10 m0 0 h16 m-108 -10 v20 m118 0 v-20 m-118 20 v24 m118 0 v-24 m-118 24 q0 10 10 10 m98 0 q10 0 10 -10 m-108 10 h10 m78 0 h10 m40 -88 h10 m0 0 h288 m-318 0 h20 m298 0 h20 m-338 0 q10 0 10 10 m318 0 q0 -10 10 -10 m-328 10 v12 m318 0 v-12 m-318 12 q0 10 10 10 m298 0 q10 0 10 -10 m-308 10 h10 m86 0 h10 m0 0 h10 m104 0 h10 m0 0 h10 m48 0 h10 m20 -32 h10 m104 0 h10 m2 0 l2 0 m2 0 l2 0 m2 0 l2 0 m-202 154 l2 0 m2 0 l2 0 m2 0 l2 0 m2 0 h10 m152 0 h10 m3 0 h-3"></path>
<polygon points="623 171 631 167 631 175"></polygon>
<polygon points="623 171 615 167 615 175"></polygon></svg></div>
28 changes: 28 additions & 0 deletions _includes/v19.2/sql/diagrams/window_definition.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<div><svg width="653" height="103">
<polygon points="9 17 1 13 1 21"></polygon>
<polygon points="17 17 9 13 9 21"></polygon><a xlink:href="sql-grammar.html#window_name" xlink:title="window_name">
<rect x="31" y="3" width="110" height="32"></rect>
<rect x="29" y="1" width="110" height="32" class="nonterminal"></rect>
<text class="nonterminal" x="39" y="21">window_name</text></a><rect x="161" y="3" width="38" height="32" rx="10"></rect>
<rect x="159" y="1" width="38" height="32" class="terminal" rx="10"></rect>
<text class="terminal" x="169" y="21">AS</text>
<rect x="219" y="3" width="26" height="32" rx="10"></rect>
<rect x="217" y="1" width="26" height="32" class="terminal" rx="10"></rect>
<text class="terminal" x="227" y="21">(</text><a xlink:href="sql-grammar.html#opt_existing_window_name" xlink:title="opt_existing_window_name">
<rect x="265" y="3" width="196" height="32"></rect>
<rect x="263" y="1" width="196" height="32" class="nonterminal"></rect>
<text class="nonterminal" x="273" y="21">opt_existing_window_name</text></a><a xlink:href="sql-grammar.html#opt_partition_clause" xlink:title="opt_partition_clause">
<rect x="481" y="3" width="150" height="32"></rect>
<rect x="479" y="1" width="150" height="32" class="nonterminal"></rect>
<text class="nonterminal" x="489" y="21">opt_partition_clause</text></a><a xlink:href="sql-grammar.html#opt_sort_clause" xlink:title="opt_sort_clause">
<rect x="303" y="69" width="122" height="32"></rect>
<rect x="301" y="67" width="122" height="32" class="nonterminal"></rect>
<text class="nonterminal" x="311" y="87">opt_sort_clause</text></a><a xlink:href="sql-grammar.html#opt_frame_clause" xlink:title="opt_frame_clause">
<rect x="445" y="69" width="134" height="32"></rect>
<rect x="443" y="67" width="134" height="32" class="nonterminal"></rect>
<text class="nonterminal" x="453" y="87">opt_frame_clause</text></a><rect x="599" y="69" width="26" height="32" rx="10"></rect>
<rect x="597" y="67" width="26" height="32" class="terminal" rx="10"></rect>
<text class="terminal" x="607" y="87">)</text>
<path class="line" d="m17 17 h2 m0 0 h10 m110 0 h10 m0 0 h10 m38 0 h10 m0 0 h10 m26 0 h10 m0 0 h10 m196 0 h10 m0 0 h10 m150 0 h10 m2 0 l2 0 m2 0 l2 0 m2 0 l2 0 m-372 66 l2 0 m2 0 l2 0 m2 0 l2 0 m2 0 h10 m122 0 h10 m0 0 h10 m134 0 h10 m0 0 h10 m26 0 h10 m3 0 h-3"></path>
<polygon points="643 83 651 79 651 87"></polygon>
<polygon points="643 83 635 79 635 87"></polygon></svg></div>
2 changes: 1 addition & 1 deletion v19.2/select-clause.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Parameter | Description
`WHERE a_expr` | Only retrieve rows that return `TRUE` for `a_expr`, which must be a [scalar expression](scalar-expressions.html) that returns Boolean values using columns (e.g., `<column> = <value>`).
`GROUP BY a_expr` | When using [aggregate functions](functions-and-operators.html#aggregate-functions) in `target_elem` or `HAVING`, list the column groupings after `GROUP BY`.
`HAVING a_expr` | Only retrieve aggregate function groups that return `TRUE` for `a_expr`, which must be a [scalar expression](scalar-expressions.html) that returns Boolean values using an aggregate function (e.g., `<aggregate function> = <value>`). <br/><br/>`HAVING` works like the `WHERE` clause, but for aggregate functions.
`WINDOW window_definition_list` | A list of [window functions definitions](window-functions.html).
`WINDOW window_definition_list` | A list of [window definitions](window-functions.html#window-definitions).

## Eliminate duplicate rows

Expand Down
Loading

0 comments on commit 78e4399

Please sign in to comment.