Documentation Source Text

Check-in [221cce4209]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix typos in the windowfunctions.html document.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 221cce4209f950a4b91372aed71f477daf883e7acfb981295d22502dbc40fc21
User & Date: drh 2018-09-12 10:49:36.651
Context
2018-09-13
12:50
Updates to the geopoly documentation. (check-in: f1742a52f5 user: drh tags: trunk)
2018-09-12
10:49
Fix typos in the windowfunctions.html document. (check-in: 221cce4209 user: drh tags: trunk)
2018-09-11
22:44
Fix typos in the geopoly document. (check-in: 81cf14c724 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to pages/windowfunctions.in.
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
presence of an OVER clause.  If a function invocation has an OVER clause
then it is a window function, and if lacks a OVER clause it is an ordinary
function.  Window functions might also have a FILTER
clause in between the function and the OVER clause.

<p>Unlike ordinary functions, window functions
cannot use the DISTINCT keyword.
Also, Window functions may only appears in the result set and in the
ORDER BY clause of a SELECT statement.

<p>The following simple table is used to demonstrate how window
functions work:

<codeblock>
  CREATE TABLE t0(x INTEGER PRIMARY KEY, y TEXT);







|







18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
presence of an OVER clause.  If a function invocation has an OVER clause
then it is a window function, and if lacks a OVER clause it is an ordinary
function.  Window functions might also have a FILTER
clause in between the function and the OVER clause.

<p>Unlike ordinary functions, window functions
cannot use the DISTINCT keyword.
Also, Window functions may only appear in the result set and in the
ORDER BY clause of a SELECT statement.

<p>The following simple table is used to demonstrate how window
functions work:

<codeblock>
  CREATE TABLE t0(x INTEGER PRIMARY KEY, y TEXT);
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
       non-negative integer. In this case the value returned is the result
       of evaluating <i>expr</i> against the row <i>offset</i> rows before the
       current row within the partition. If <i>offset</i> is 0, then
       <i>expr</i> is evaluated against the current row. If there is no row
       <i>offset</i> rows before the current row, NULL is returned.

      <p> If <i>default</i> is also provided, then it is returned instead of
      NULL if row identified by <i>offset</i> does not exist.
       
  <dt><p><b>lead(expr)<br>lead(expr, offset)<br>lead(expr, offset, default)</b>
  <dd><p> The first form of the lead() function returns the result of evaluating
       expression <i>expr</i> against the next row in the partition. Or, if
       there is no next row (because the current row is the last), NULL.

      <p> If the <i>offset</i> argument is provided, then it must be a
       non-negative integer. In this case the value returned is the result
       of evaluating <i>expr</i> against the row <i>offset</i> rows after the
       current row within the partition. If <i>offset</i> is 0, then
       <i>expr</i> is evaluated against the current row. If there is no row
       <i>offset</i> rows after the current row, NULL is returned.

      <p> If <i>default</i> is also provided, then it is returned instead of
      NULL if row identified by <i>offset</i> does not exist.
  <dt><p><b>first_value(expr)</b>
  <dd><p> This built-in window function calculates the window frame for each
       row in the same way as an aggregate window function. It returns the
       value of <i>expr</i> evaluated against the first row in the window frame
       for each row.
  <dt><p><b>last_value(expr)</b>
  <dd><p> This built-in window function calculates the window frame for each







|














|







363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
       non-negative integer. In this case the value returned is the result
       of evaluating <i>expr</i> against the row <i>offset</i> rows before the
       current row within the partition. If <i>offset</i> is 0, then
       <i>expr</i> is evaluated against the current row. If there is no row
       <i>offset</i> rows before the current row, NULL is returned.

      <p> If <i>default</i> is also provided, then it is returned instead of
      NULL if the row identified by <i>offset</i> does not exist.
       
  <dt><p><b>lead(expr)<br>lead(expr, offset)<br>lead(expr, offset, default)</b>
  <dd><p> The first form of the lead() function returns the result of evaluating
       expression <i>expr</i> against the next row in the partition. Or, if
       there is no next row (because the current row is the last), NULL.

      <p> If the <i>offset</i> argument is provided, then it must be a
       non-negative integer. In this case the value returned is the result
       of evaluating <i>expr</i> against the row <i>offset</i> rows after the
       current row within the partition. If <i>offset</i> is 0, then
       <i>expr</i> is evaluated against the current row. If there is no row
       <i>offset</i> rows after the current row, NULL is returned.

      <p> If <i>default</i> is also provided, then it is returned instead of
      NULL if the row identified by <i>offset</i> does not exist.
  <dt><p><b>first_value(expr)</b>
  <dd><p> This built-in window function calculates the window frame for each
       row in the same way as an aggregate window function. It returns the
       value of <i>expr</i> evaluated against the first row in the window frame
       for each row.
  <dt><p><b>last_value(expr)</b>
  <dd><p> This built-in window function calculates the window frame for each