github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/docs/generated/sql/window_functions.md (about) 1 <table> 2 <thead><tr><th>Function → Returns</th><th>Description</th></tr></thead> 3 <tbody> 4 <tr><td><a name="cume_dist"></a><code>cume_dist() → <a href="float.html">float</a></code></td><td><span class="funcdesc"><p>Calculates the relative rank of the current row: (number of rows preceding or peer with current row) / (total rows).</p> 5 </span></td></tr> 6 <tr><td><a name="dense_rank"></a><code>dense_rank() → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Calculates the rank of the current row without gaps; this function counts peer groups.</p> 7 </span></td></tr> 8 <tr><td><a name="first_value"></a><code>first_value(val: <a href="bool.html">bool</a>) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is the first row of the window frame.</p> 9 </span></td></tr> 10 <tr><td><a name="first_value"></a><code>first_value(val: <a href="bytes.html">bytes</a>) → <a href="bytes.html">bytes</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is the first row of the window frame.</p> 11 </span></td></tr> 12 <tr><td><a name="first_value"></a><code>first_value(val: <a href="date.html">date</a>) → <a href="date.html">date</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is the first row of the window frame.</p> 13 </span></td></tr> 14 <tr><td><a name="first_value"></a><code>first_value(val: <a href="decimal.html">decimal</a>) → <a href="decimal.html">decimal</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is the first row of the window frame.</p> 15 </span></td></tr> 16 <tr><td><a name="first_value"></a><code>first_value(val: <a href="float.html">float</a>) → <a href="float.html">float</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is the first row of the window frame.</p> 17 </span></td></tr> 18 <tr><td><a name="first_value"></a><code>first_value(val: <a href="inet.html">inet</a>) → <a href="inet.html">inet</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is the first row of the window frame.</p> 19 </span></td></tr> 20 <tr><td><a name="first_value"></a><code>first_value(val: <a href="int.html">int</a>) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is the first row of the window frame.</p> 21 </span></td></tr> 22 <tr><td><a name="first_value"></a><code>first_value(val: <a href="interval.html">interval</a>) → <a href="interval.html">interval</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is the first row of the window frame.</p> 23 </span></td></tr> 24 <tr><td><a name="first_value"></a><code>first_value(val: <a href="string.html">string</a>) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is the first row of the window frame.</p> 25 </span></td></tr> 26 <tr><td><a name="first_value"></a><code>first_value(val: <a href="time.html">time</a>) → <a href="time.html">time</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is the first row of the window frame.</p> 27 </span></td></tr> 28 <tr><td><a name="first_value"></a><code>first_value(val: <a href="timestamp.html">timestamp</a>) → <a href="timestamp.html">timestamp</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is the first row of the window frame.</p> 29 </span></td></tr> 30 <tr><td><a name="first_value"></a><code>first_value(val: <a href="timestamp.html">timestamptz</a>) → <a href="timestamp.html">timestamptz</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is the first row of the window frame.</p> 31 </span></td></tr> 32 <tr><td><a name="first_value"></a><code>first_value(val: <a href="uuid.html">uuid</a>) → <a href="uuid.html">uuid</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is the first row of the window frame.</p> 33 </span></td></tr> 34 <tr><td><a name="first_value"></a><code>first_value(val: geography) → geography</code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is the first row of the window frame.</p> 35 </span></td></tr> 36 <tr><td><a name="first_value"></a><code>first_value(val: geometry) → geometry</code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is the first row of the window frame.</p> 37 </span></td></tr> 38 <tr><td><a name="first_value"></a><code>first_value(val: jsonb) → jsonb</code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is the first row of the window frame.</p> 39 </span></td></tr> 40 <tr><td><a name="first_value"></a><code>first_value(val: oid) → oid</code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is the first row of the window frame.</p> 41 </span></td></tr> 42 <tr><td><a name="first_value"></a><code>first_value(val: timetz) → timetz</code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is the first row of the window frame.</p> 43 </span></td></tr> 44 <tr><td><a name="first_value"></a><code>first_value(val: varbit) → varbit</code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is the first row of the window frame.</p> 45 </span></td></tr> 46 <tr><td><a name="lag"></a><code>lag(val: <a href="bool.html">bool</a>) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the previous row within current row’s partition; if there is no such row, instead returns null.</p> 47 </span></td></tr> 48 <tr><td><a name="lag"></a><code>lag(val: <a href="bool.html">bool</a>, n: <a href="int.html">int</a>) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows before the current row within its partition; if there is no such row, instead returns null. <code>n</code> is evaluated with respect to the current row.</p> 49 </span></td></tr> 50 <tr><td><a name="lag"></a><code>lag(val: <a href="bool.html">bool</a>, n: <a href="int.html">int</a>, default: <a href="bool.html">bool</a>) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows before the current row within its partition; if there is no such, row, instead returns <code>default</code> (which must be of the same type as <code>val</code>). Both <code>n</code> and <code>default</code> are evaluated with respect to the current row.</p> 51 </span></td></tr> 52 <tr><td><a name="lag"></a><code>lag(val: <a href="bytes.html">bytes</a>) → <a href="bytes.html">bytes</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the previous row within current row’s partition; if there is no such row, instead returns null.</p> 53 </span></td></tr> 54 <tr><td><a name="lag"></a><code>lag(val: <a href="bytes.html">bytes</a>, n: <a href="int.html">int</a>) → <a href="bytes.html">bytes</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows before the current row within its partition; if there is no such row, instead returns null. <code>n</code> is evaluated with respect to the current row.</p> 55 </span></td></tr> 56 <tr><td><a name="lag"></a><code>lag(val: <a href="bytes.html">bytes</a>, n: <a href="int.html">int</a>, default: <a href="bytes.html">bytes</a>) → <a href="bytes.html">bytes</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows before the current row within its partition; if there is no such, row, instead returns <code>default</code> (which must be of the same type as <code>val</code>). Both <code>n</code> and <code>default</code> are evaluated with respect to the current row.</p> 57 </span></td></tr> 58 <tr><td><a name="lag"></a><code>lag(val: <a href="date.html">date</a>) → <a href="date.html">date</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the previous row within current row’s partition; if there is no such row, instead returns null.</p> 59 </span></td></tr> 60 <tr><td><a name="lag"></a><code>lag(val: <a href="date.html">date</a>, n: <a href="int.html">int</a>) → <a href="date.html">date</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows before the current row within its partition; if there is no such row, instead returns null. <code>n</code> is evaluated with respect to the current row.</p> 61 </span></td></tr> 62 <tr><td><a name="lag"></a><code>lag(val: <a href="date.html">date</a>, n: <a href="int.html">int</a>, default: <a href="date.html">date</a>) → <a href="date.html">date</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows before the current row within its partition; if there is no such, row, instead returns <code>default</code> (which must be of the same type as <code>val</code>). Both <code>n</code> and <code>default</code> are evaluated with respect to the current row.</p> 63 </span></td></tr> 64 <tr><td><a name="lag"></a><code>lag(val: <a href="decimal.html">decimal</a>) → <a href="decimal.html">decimal</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the previous row within current row’s partition; if there is no such row, instead returns null.</p> 65 </span></td></tr> 66 <tr><td><a name="lag"></a><code>lag(val: <a href="decimal.html">decimal</a>, n: <a href="int.html">int</a>) → <a href="decimal.html">decimal</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows before the current row within its partition; if there is no such row, instead returns null. <code>n</code> is evaluated with respect to the current row.</p> 67 </span></td></tr> 68 <tr><td><a name="lag"></a><code>lag(val: <a href="decimal.html">decimal</a>, n: <a href="int.html">int</a>, default: <a href="decimal.html">decimal</a>) → <a href="decimal.html">decimal</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows before the current row within its partition; if there is no such, row, instead returns <code>default</code> (which must be of the same type as <code>val</code>). Both <code>n</code> and <code>default</code> are evaluated with respect to the current row.</p> 69 </span></td></tr> 70 <tr><td><a name="lag"></a><code>lag(val: <a href="float.html">float</a>) → <a href="float.html">float</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the previous row within current row’s partition; if there is no such row, instead returns null.</p> 71 </span></td></tr> 72 <tr><td><a name="lag"></a><code>lag(val: <a href="float.html">float</a>, n: <a href="int.html">int</a>) → <a href="float.html">float</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows before the current row within its partition; if there is no such row, instead returns null. <code>n</code> is evaluated with respect to the current row.</p> 73 </span></td></tr> 74 <tr><td><a name="lag"></a><code>lag(val: <a href="float.html">float</a>, n: <a href="int.html">int</a>, default: <a href="float.html">float</a>) → <a href="float.html">float</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows before the current row within its partition; if there is no such, row, instead returns <code>default</code> (which must be of the same type as <code>val</code>). Both <code>n</code> and <code>default</code> are evaluated with respect to the current row.</p> 75 </span></td></tr> 76 <tr><td><a name="lag"></a><code>lag(val: <a href="inet.html">inet</a>) → <a href="inet.html">inet</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the previous row within current row’s partition; if there is no such row, instead returns null.</p> 77 </span></td></tr> 78 <tr><td><a name="lag"></a><code>lag(val: <a href="inet.html">inet</a>, n: <a href="int.html">int</a>) → <a href="inet.html">inet</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows before the current row within its partition; if there is no such row, instead returns null. <code>n</code> is evaluated with respect to the current row.</p> 79 </span></td></tr> 80 <tr><td><a name="lag"></a><code>lag(val: <a href="inet.html">inet</a>, n: <a href="int.html">int</a>, default: <a href="inet.html">inet</a>) → <a href="inet.html">inet</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows before the current row within its partition; if there is no such, row, instead returns <code>default</code> (which must be of the same type as <code>val</code>). Both <code>n</code> and <code>default</code> are evaluated with respect to the current row.</p> 81 </span></td></tr> 82 <tr><td><a name="lag"></a><code>lag(val: <a href="int.html">int</a>) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the previous row within current row’s partition; if there is no such row, instead returns null.</p> 83 </span></td></tr> 84 <tr><td><a name="lag"></a><code>lag(val: <a href="int.html">int</a>, n: <a href="int.html">int</a>) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows before the current row within its partition; if there is no such row, instead returns null. <code>n</code> is evaluated with respect to the current row.</p> 85 </span></td></tr> 86 <tr><td><a name="lag"></a><code>lag(val: <a href="int.html">int</a>, n: <a href="int.html">int</a>, default: <a href="int.html">int</a>) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows before the current row within its partition; if there is no such, row, instead returns <code>default</code> (which must be of the same type as <code>val</code>). Both <code>n</code> and <code>default</code> are evaluated with respect to the current row.</p> 87 </span></td></tr> 88 <tr><td><a name="lag"></a><code>lag(val: <a href="interval.html">interval</a>) → <a href="interval.html">interval</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the previous row within current row’s partition; if there is no such row, instead returns null.</p> 89 </span></td></tr> 90 <tr><td><a name="lag"></a><code>lag(val: <a href="interval.html">interval</a>, n: <a href="int.html">int</a>) → <a href="interval.html">interval</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows before the current row within its partition; if there is no such row, instead returns null. <code>n</code> is evaluated with respect to the current row.</p> 91 </span></td></tr> 92 <tr><td><a name="lag"></a><code>lag(val: <a href="interval.html">interval</a>, n: <a href="int.html">int</a>, default: <a href="interval.html">interval</a>) → <a href="interval.html">interval</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows before the current row within its partition; if there is no such, row, instead returns <code>default</code> (which must be of the same type as <code>val</code>). Both <code>n</code> and <code>default</code> are evaluated with respect to the current row.</p> 93 </span></td></tr> 94 <tr><td><a name="lag"></a><code>lag(val: <a href="string.html">string</a>) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the previous row within current row’s partition; if there is no such row, instead returns null.</p> 95 </span></td></tr> 96 <tr><td><a name="lag"></a><code>lag(val: <a href="string.html">string</a>, n: <a href="int.html">int</a>) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows before the current row within its partition; if there is no such row, instead returns null. <code>n</code> is evaluated with respect to the current row.</p> 97 </span></td></tr> 98 <tr><td><a name="lag"></a><code>lag(val: <a href="string.html">string</a>, n: <a href="int.html">int</a>, default: <a href="string.html">string</a>) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows before the current row within its partition; if there is no such, row, instead returns <code>default</code> (which must be of the same type as <code>val</code>). Both <code>n</code> and <code>default</code> are evaluated with respect to the current row.</p> 99 </span></td></tr> 100 <tr><td><a name="lag"></a><code>lag(val: <a href="time.html">time</a>) → <a href="time.html">time</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the previous row within current row’s partition; if there is no such row, instead returns null.</p> 101 </span></td></tr> 102 <tr><td><a name="lag"></a><code>lag(val: <a href="time.html">time</a>, n: <a href="int.html">int</a>) → <a href="time.html">time</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows before the current row within its partition; if there is no such row, instead returns null. <code>n</code> is evaluated with respect to the current row.</p> 103 </span></td></tr> 104 <tr><td><a name="lag"></a><code>lag(val: <a href="time.html">time</a>, n: <a href="int.html">int</a>, default: <a href="time.html">time</a>) → <a href="time.html">time</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows before the current row within its partition; if there is no such, row, instead returns <code>default</code> (which must be of the same type as <code>val</code>). Both <code>n</code> and <code>default</code> are evaluated with respect to the current row.</p> 105 </span></td></tr> 106 <tr><td><a name="lag"></a><code>lag(val: <a href="timestamp.html">timestamp</a>) → <a href="timestamp.html">timestamp</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the previous row within current row’s partition; if there is no such row, instead returns null.</p> 107 </span></td></tr> 108 <tr><td><a name="lag"></a><code>lag(val: <a href="timestamp.html">timestamp</a>, n: <a href="int.html">int</a>) → <a href="timestamp.html">timestamp</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows before the current row within its partition; if there is no such row, instead returns null. <code>n</code> is evaluated with respect to the current row.</p> 109 </span></td></tr> 110 <tr><td><a name="lag"></a><code>lag(val: <a href="timestamp.html">timestamp</a>, n: <a href="int.html">int</a>, default: <a href="timestamp.html">timestamp</a>) → <a href="timestamp.html">timestamp</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows before the current row within its partition; if there is no such, row, instead returns <code>default</code> (which must be of the same type as <code>val</code>). Both <code>n</code> and <code>default</code> are evaluated with respect to the current row.</p> 111 </span></td></tr> 112 <tr><td><a name="lag"></a><code>lag(val: <a href="timestamp.html">timestamptz</a>) → <a href="timestamp.html">timestamptz</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the previous row within current row’s partition; if there is no such row, instead returns null.</p> 113 </span></td></tr> 114 <tr><td><a name="lag"></a><code>lag(val: <a href="timestamp.html">timestamptz</a>, n: <a href="int.html">int</a>) → <a href="timestamp.html">timestamptz</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows before the current row within its partition; if there is no such row, instead returns null. <code>n</code> is evaluated with respect to the current row.</p> 115 </span></td></tr> 116 <tr><td><a name="lag"></a><code>lag(val: <a href="timestamp.html">timestamptz</a>, n: <a href="int.html">int</a>, default: <a href="timestamp.html">timestamptz</a>) → <a href="timestamp.html">timestamptz</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows before the current row within its partition; if there is no such, row, instead returns <code>default</code> (which must be of the same type as <code>val</code>). Both <code>n</code> and <code>default</code> are evaluated with respect to the current row.</p> 117 </span></td></tr> 118 <tr><td><a name="lag"></a><code>lag(val: <a href="uuid.html">uuid</a>) → <a href="uuid.html">uuid</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the previous row within current row’s partition; if there is no such row, instead returns null.</p> 119 </span></td></tr> 120 <tr><td><a name="lag"></a><code>lag(val: <a href="uuid.html">uuid</a>, n: <a href="int.html">int</a>) → <a href="uuid.html">uuid</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows before the current row within its partition; if there is no such row, instead returns null. <code>n</code> is evaluated with respect to the current row.</p> 121 </span></td></tr> 122 <tr><td><a name="lag"></a><code>lag(val: <a href="uuid.html">uuid</a>, n: <a href="int.html">int</a>, default: <a href="uuid.html">uuid</a>) → <a href="uuid.html">uuid</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows before the current row within its partition; if there is no such, row, instead returns <code>default</code> (which must be of the same type as <code>val</code>). Both <code>n</code> and <code>default</code> are evaluated with respect to the current row.</p> 123 </span></td></tr> 124 <tr><td><a name="lag"></a><code>lag(val: geography) → geography</code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the previous row within current row’s partition; if there is no such row, instead returns null.</p> 125 </span></td></tr> 126 <tr><td><a name="lag"></a><code>lag(val: geography, n: <a href="int.html">int</a>) → geography</code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows before the current row within its partition; if there is no such row, instead returns null. <code>n</code> is evaluated with respect to the current row.</p> 127 </span></td></tr> 128 <tr><td><a name="lag"></a><code>lag(val: geography, n: <a href="int.html">int</a>, default: geography) → geography</code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows before the current row within its partition; if there is no such, row, instead returns <code>default</code> (which must be of the same type as <code>val</code>). Both <code>n</code> and <code>default</code> are evaluated with respect to the current row.</p> 129 </span></td></tr> 130 <tr><td><a name="lag"></a><code>lag(val: geometry) → geometry</code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the previous row within current row’s partition; if there is no such row, instead returns null.</p> 131 </span></td></tr> 132 <tr><td><a name="lag"></a><code>lag(val: geometry, n: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows before the current row within its partition; if there is no such row, instead returns null. <code>n</code> is evaluated with respect to the current row.</p> 133 </span></td></tr> 134 <tr><td><a name="lag"></a><code>lag(val: geometry, n: <a href="int.html">int</a>, default: geometry) → geometry</code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows before the current row within its partition; if there is no such, row, instead returns <code>default</code> (which must be of the same type as <code>val</code>). Both <code>n</code> and <code>default</code> are evaluated with respect to the current row.</p> 135 </span></td></tr> 136 <tr><td><a name="lag"></a><code>lag(val: jsonb) → jsonb</code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the previous row within current row’s partition; if there is no such row, instead returns null.</p> 137 </span></td></tr> 138 <tr><td><a name="lag"></a><code>lag(val: jsonb, n: <a href="int.html">int</a>) → jsonb</code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows before the current row within its partition; if there is no such row, instead returns null. <code>n</code> is evaluated with respect to the current row.</p> 139 </span></td></tr> 140 <tr><td><a name="lag"></a><code>lag(val: jsonb, n: <a href="int.html">int</a>, default: jsonb) → jsonb</code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows before the current row within its partition; if there is no such, row, instead returns <code>default</code> (which must be of the same type as <code>val</code>). Both <code>n</code> and <code>default</code> are evaluated with respect to the current row.</p> 141 </span></td></tr> 142 <tr><td><a name="lag"></a><code>lag(val: oid) → oid</code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the previous row within current row’s partition; if there is no such row, instead returns null.</p> 143 </span></td></tr> 144 <tr><td><a name="lag"></a><code>lag(val: oid, n: <a href="int.html">int</a>) → oid</code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows before the current row within its partition; if there is no such row, instead returns null. <code>n</code> is evaluated with respect to the current row.</p> 145 </span></td></tr> 146 <tr><td><a name="lag"></a><code>lag(val: oid, n: <a href="int.html">int</a>, default: oid) → oid</code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows before the current row within its partition; if there is no such, row, instead returns <code>default</code> (which must be of the same type as <code>val</code>). Both <code>n</code> and <code>default</code> are evaluated with respect to the current row.</p> 147 </span></td></tr> 148 <tr><td><a name="lag"></a><code>lag(val: timetz) → timetz</code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the previous row within current row’s partition; if there is no such row, instead returns null.</p> 149 </span></td></tr> 150 <tr><td><a name="lag"></a><code>lag(val: timetz, n: <a href="int.html">int</a>) → timetz</code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows before the current row within its partition; if there is no such row, instead returns null. <code>n</code> is evaluated with respect to the current row.</p> 151 </span></td></tr> 152 <tr><td><a name="lag"></a><code>lag(val: timetz, n: <a href="int.html">int</a>, default: timetz) → timetz</code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows before the current row within its partition; if there is no such, row, instead returns <code>default</code> (which must be of the same type as <code>val</code>). Both <code>n</code> and <code>default</code> are evaluated with respect to the current row.</p> 153 </span></td></tr> 154 <tr><td><a name="lag"></a><code>lag(val: varbit) → varbit</code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the previous row within current row’s partition; if there is no such row, instead returns null.</p> 155 </span></td></tr> 156 <tr><td><a name="lag"></a><code>lag(val: varbit, n: <a href="int.html">int</a>) → varbit</code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows before the current row within its partition; if there is no such row, instead returns null. <code>n</code> is evaluated with respect to the current row.</p> 157 </span></td></tr> 158 <tr><td><a name="lag"></a><code>lag(val: varbit, n: <a href="int.html">int</a>, default: varbit) → varbit</code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows before the current row within its partition; if there is no such, row, instead returns <code>default</code> (which must be of the same type as <code>val</code>). Both <code>n</code> and <code>default</code> are evaluated with respect to the current row.</p> 159 </span></td></tr> 160 <tr><td><a name="last_value"></a><code>last_value(val: <a href="bool.html">bool</a>) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is the last row of the window frame.</p> 161 </span></td></tr> 162 <tr><td><a name="last_value"></a><code>last_value(val: <a href="bytes.html">bytes</a>) → <a href="bytes.html">bytes</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is the last row of the window frame.</p> 163 </span></td></tr> 164 <tr><td><a name="last_value"></a><code>last_value(val: <a href="date.html">date</a>) → <a href="date.html">date</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is the last row of the window frame.</p> 165 </span></td></tr> 166 <tr><td><a name="last_value"></a><code>last_value(val: <a href="decimal.html">decimal</a>) → <a href="decimal.html">decimal</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is the last row of the window frame.</p> 167 </span></td></tr> 168 <tr><td><a name="last_value"></a><code>last_value(val: <a href="float.html">float</a>) → <a href="float.html">float</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is the last row of the window frame.</p> 169 </span></td></tr> 170 <tr><td><a name="last_value"></a><code>last_value(val: <a href="inet.html">inet</a>) → <a href="inet.html">inet</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is the last row of the window frame.</p> 171 </span></td></tr> 172 <tr><td><a name="last_value"></a><code>last_value(val: <a href="int.html">int</a>) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is the last row of the window frame.</p> 173 </span></td></tr> 174 <tr><td><a name="last_value"></a><code>last_value(val: <a href="interval.html">interval</a>) → <a href="interval.html">interval</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is the last row of the window frame.</p> 175 </span></td></tr> 176 <tr><td><a name="last_value"></a><code>last_value(val: <a href="string.html">string</a>) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is the last row of the window frame.</p> 177 </span></td></tr> 178 <tr><td><a name="last_value"></a><code>last_value(val: <a href="time.html">time</a>) → <a href="time.html">time</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is the last row of the window frame.</p> 179 </span></td></tr> 180 <tr><td><a name="last_value"></a><code>last_value(val: <a href="timestamp.html">timestamp</a>) → <a href="timestamp.html">timestamp</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is the last row of the window frame.</p> 181 </span></td></tr> 182 <tr><td><a name="last_value"></a><code>last_value(val: <a href="timestamp.html">timestamptz</a>) → <a href="timestamp.html">timestamptz</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is the last row of the window frame.</p> 183 </span></td></tr> 184 <tr><td><a name="last_value"></a><code>last_value(val: <a href="uuid.html">uuid</a>) → <a href="uuid.html">uuid</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is the last row of the window frame.</p> 185 </span></td></tr> 186 <tr><td><a name="last_value"></a><code>last_value(val: geography) → geography</code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is the last row of the window frame.</p> 187 </span></td></tr> 188 <tr><td><a name="last_value"></a><code>last_value(val: geometry) → geometry</code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is the last row of the window frame.</p> 189 </span></td></tr> 190 <tr><td><a name="last_value"></a><code>last_value(val: jsonb) → jsonb</code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is the last row of the window frame.</p> 191 </span></td></tr> 192 <tr><td><a name="last_value"></a><code>last_value(val: oid) → oid</code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is the last row of the window frame.</p> 193 </span></td></tr> 194 <tr><td><a name="last_value"></a><code>last_value(val: timetz) → timetz</code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is the last row of the window frame.</p> 195 </span></td></tr> 196 <tr><td><a name="last_value"></a><code>last_value(val: varbit) → varbit</code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is the last row of the window frame.</p> 197 </span></td></tr> 198 <tr><td><a name="lead"></a><code>lead(val: <a href="bool.html">bool</a>) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the following row within current row’s partition; if there is no such row, instead returns null.</p> 199 </span></td></tr> 200 <tr><td><a name="lead"></a><code>lead(val: <a href="bool.html">bool</a>, n: <a href="int.html">int</a>) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows after the current row within its partition; if there is no such row, instead returns null. <code>n</code> is evaluated with respect to the current row.</p> 201 </span></td></tr> 202 <tr><td><a name="lead"></a><code>lead(val: <a href="bool.html">bool</a>, n: <a href="int.html">int</a>, default: <a href="bool.html">bool</a>) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows after the current row within its partition; if there is no such, row, instead returns <code>default</code> (which must be of the same type as <code>val</code>). Both <code>n</code> and <code>default</code> are evaluated with respect to the current row.</p> 203 </span></td></tr> 204 <tr><td><a name="lead"></a><code>lead(val: <a href="bytes.html">bytes</a>) → <a href="bytes.html">bytes</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the following row within current row’s partition; if there is no such row, instead returns null.</p> 205 </span></td></tr> 206 <tr><td><a name="lead"></a><code>lead(val: <a href="bytes.html">bytes</a>, n: <a href="int.html">int</a>) → <a href="bytes.html">bytes</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows after the current row within its partition; if there is no such row, instead returns null. <code>n</code> is evaluated with respect to the current row.</p> 207 </span></td></tr> 208 <tr><td><a name="lead"></a><code>lead(val: <a href="bytes.html">bytes</a>, n: <a href="int.html">int</a>, default: <a href="bytes.html">bytes</a>) → <a href="bytes.html">bytes</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows after the current row within its partition; if there is no such, row, instead returns <code>default</code> (which must be of the same type as <code>val</code>). Both <code>n</code> and <code>default</code> are evaluated with respect to the current row.</p> 209 </span></td></tr> 210 <tr><td><a name="lead"></a><code>lead(val: <a href="date.html">date</a>) → <a href="date.html">date</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the following row within current row’s partition; if there is no such row, instead returns null.</p> 211 </span></td></tr> 212 <tr><td><a name="lead"></a><code>lead(val: <a href="date.html">date</a>, n: <a href="int.html">int</a>) → <a href="date.html">date</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows after the current row within its partition; if there is no such row, instead returns null. <code>n</code> is evaluated with respect to the current row.</p> 213 </span></td></tr> 214 <tr><td><a name="lead"></a><code>lead(val: <a href="date.html">date</a>, n: <a href="int.html">int</a>, default: <a href="date.html">date</a>) → <a href="date.html">date</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows after the current row within its partition; if there is no such, row, instead returns <code>default</code> (which must be of the same type as <code>val</code>). Both <code>n</code> and <code>default</code> are evaluated with respect to the current row.</p> 215 </span></td></tr> 216 <tr><td><a name="lead"></a><code>lead(val: <a href="decimal.html">decimal</a>) → <a href="decimal.html">decimal</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the following row within current row’s partition; if there is no such row, instead returns null.</p> 217 </span></td></tr> 218 <tr><td><a name="lead"></a><code>lead(val: <a href="decimal.html">decimal</a>, n: <a href="int.html">int</a>) → <a href="decimal.html">decimal</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows after the current row within its partition; if there is no such row, instead returns null. <code>n</code> is evaluated with respect to the current row.</p> 219 </span></td></tr> 220 <tr><td><a name="lead"></a><code>lead(val: <a href="decimal.html">decimal</a>, n: <a href="int.html">int</a>, default: <a href="decimal.html">decimal</a>) → <a href="decimal.html">decimal</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows after the current row within its partition; if there is no such, row, instead returns <code>default</code> (which must be of the same type as <code>val</code>). Both <code>n</code> and <code>default</code> are evaluated with respect to the current row.</p> 221 </span></td></tr> 222 <tr><td><a name="lead"></a><code>lead(val: <a href="float.html">float</a>) → <a href="float.html">float</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the following row within current row’s partition; if there is no such row, instead returns null.</p> 223 </span></td></tr> 224 <tr><td><a name="lead"></a><code>lead(val: <a href="float.html">float</a>, n: <a href="int.html">int</a>) → <a href="float.html">float</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows after the current row within its partition; if there is no such row, instead returns null. <code>n</code> is evaluated with respect to the current row.</p> 225 </span></td></tr> 226 <tr><td><a name="lead"></a><code>lead(val: <a href="float.html">float</a>, n: <a href="int.html">int</a>, default: <a href="float.html">float</a>) → <a href="float.html">float</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows after the current row within its partition; if there is no such, row, instead returns <code>default</code> (which must be of the same type as <code>val</code>). Both <code>n</code> and <code>default</code> are evaluated with respect to the current row.</p> 227 </span></td></tr> 228 <tr><td><a name="lead"></a><code>lead(val: <a href="inet.html">inet</a>) → <a href="inet.html">inet</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the following row within current row’s partition; if there is no such row, instead returns null.</p> 229 </span></td></tr> 230 <tr><td><a name="lead"></a><code>lead(val: <a href="inet.html">inet</a>, n: <a href="int.html">int</a>) → <a href="inet.html">inet</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows after the current row within its partition; if there is no such row, instead returns null. <code>n</code> is evaluated with respect to the current row.</p> 231 </span></td></tr> 232 <tr><td><a name="lead"></a><code>lead(val: <a href="inet.html">inet</a>, n: <a href="int.html">int</a>, default: <a href="inet.html">inet</a>) → <a href="inet.html">inet</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows after the current row within its partition; if there is no such, row, instead returns <code>default</code> (which must be of the same type as <code>val</code>). Both <code>n</code> and <code>default</code> are evaluated with respect to the current row.</p> 233 </span></td></tr> 234 <tr><td><a name="lead"></a><code>lead(val: <a href="int.html">int</a>) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the following row within current row’s partition; if there is no such row, instead returns null.</p> 235 </span></td></tr> 236 <tr><td><a name="lead"></a><code>lead(val: <a href="int.html">int</a>, n: <a href="int.html">int</a>) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows after the current row within its partition; if there is no such row, instead returns null. <code>n</code> is evaluated with respect to the current row.</p> 237 </span></td></tr> 238 <tr><td><a name="lead"></a><code>lead(val: <a href="int.html">int</a>, n: <a href="int.html">int</a>, default: <a href="int.html">int</a>) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows after the current row within its partition; if there is no such, row, instead returns <code>default</code> (which must be of the same type as <code>val</code>). Both <code>n</code> and <code>default</code> are evaluated with respect to the current row.</p> 239 </span></td></tr> 240 <tr><td><a name="lead"></a><code>lead(val: <a href="interval.html">interval</a>) → <a href="interval.html">interval</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the following row within current row’s partition; if there is no such row, instead returns null.</p> 241 </span></td></tr> 242 <tr><td><a name="lead"></a><code>lead(val: <a href="interval.html">interval</a>, n: <a href="int.html">int</a>) → <a href="interval.html">interval</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows after the current row within its partition; if there is no such row, instead returns null. <code>n</code> is evaluated with respect to the current row.</p> 243 </span></td></tr> 244 <tr><td><a name="lead"></a><code>lead(val: <a href="interval.html">interval</a>, n: <a href="int.html">int</a>, default: <a href="interval.html">interval</a>) → <a href="interval.html">interval</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows after the current row within its partition; if there is no such, row, instead returns <code>default</code> (which must be of the same type as <code>val</code>). Both <code>n</code> and <code>default</code> are evaluated with respect to the current row.</p> 245 </span></td></tr> 246 <tr><td><a name="lead"></a><code>lead(val: <a href="string.html">string</a>) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the following row within current row’s partition; if there is no such row, instead returns null.</p> 247 </span></td></tr> 248 <tr><td><a name="lead"></a><code>lead(val: <a href="string.html">string</a>, n: <a href="int.html">int</a>) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows after the current row within its partition; if there is no such row, instead returns null. <code>n</code> is evaluated with respect to the current row.</p> 249 </span></td></tr> 250 <tr><td><a name="lead"></a><code>lead(val: <a href="string.html">string</a>, n: <a href="int.html">int</a>, default: <a href="string.html">string</a>) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows after the current row within its partition; if there is no such, row, instead returns <code>default</code> (which must be of the same type as <code>val</code>). Both <code>n</code> and <code>default</code> are evaluated with respect to the current row.</p> 251 </span></td></tr> 252 <tr><td><a name="lead"></a><code>lead(val: <a href="time.html">time</a>) → <a href="time.html">time</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the following row within current row’s partition; if there is no such row, instead returns null.</p> 253 </span></td></tr> 254 <tr><td><a name="lead"></a><code>lead(val: <a href="time.html">time</a>, n: <a href="int.html">int</a>) → <a href="time.html">time</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows after the current row within its partition; if there is no such row, instead returns null. <code>n</code> is evaluated with respect to the current row.</p> 255 </span></td></tr> 256 <tr><td><a name="lead"></a><code>lead(val: <a href="time.html">time</a>, n: <a href="int.html">int</a>, default: <a href="time.html">time</a>) → <a href="time.html">time</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows after the current row within its partition; if there is no such, row, instead returns <code>default</code> (which must be of the same type as <code>val</code>). Both <code>n</code> and <code>default</code> are evaluated with respect to the current row.</p> 257 </span></td></tr> 258 <tr><td><a name="lead"></a><code>lead(val: <a href="timestamp.html">timestamp</a>) → <a href="timestamp.html">timestamp</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the following row within current row’s partition; if there is no such row, instead returns null.</p> 259 </span></td></tr> 260 <tr><td><a name="lead"></a><code>lead(val: <a href="timestamp.html">timestamp</a>, n: <a href="int.html">int</a>) → <a href="timestamp.html">timestamp</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows after the current row within its partition; if there is no such row, instead returns null. <code>n</code> is evaluated with respect to the current row.</p> 261 </span></td></tr> 262 <tr><td><a name="lead"></a><code>lead(val: <a href="timestamp.html">timestamp</a>, n: <a href="int.html">int</a>, default: <a href="timestamp.html">timestamp</a>) → <a href="timestamp.html">timestamp</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows after the current row within its partition; if there is no such, row, instead returns <code>default</code> (which must be of the same type as <code>val</code>). Both <code>n</code> and <code>default</code> are evaluated with respect to the current row.</p> 263 </span></td></tr> 264 <tr><td><a name="lead"></a><code>lead(val: <a href="timestamp.html">timestamptz</a>) → <a href="timestamp.html">timestamptz</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the following row within current row’s partition; if there is no such row, instead returns null.</p> 265 </span></td></tr> 266 <tr><td><a name="lead"></a><code>lead(val: <a href="timestamp.html">timestamptz</a>, n: <a href="int.html">int</a>) → <a href="timestamp.html">timestamptz</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows after the current row within its partition; if there is no such row, instead returns null. <code>n</code> is evaluated with respect to the current row.</p> 267 </span></td></tr> 268 <tr><td><a name="lead"></a><code>lead(val: <a href="timestamp.html">timestamptz</a>, n: <a href="int.html">int</a>, default: <a href="timestamp.html">timestamptz</a>) → <a href="timestamp.html">timestamptz</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows after the current row within its partition; if there is no such, row, instead returns <code>default</code> (which must be of the same type as <code>val</code>). Both <code>n</code> and <code>default</code> are evaluated with respect to the current row.</p> 269 </span></td></tr> 270 <tr><td><a name="lead"></a><code>lead(val: <a href="uuid.html">uuid</a>) → <a href="uuid.html">uuid</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the following row within current row’s partition; if there is no such row, instead returns null.</p> 271 </span></td></tr> 272 <tr><td><a name="lead"></a><code>lead(val: <a href="uuid.html">uuid</a>, n: <a href="int.html">int</a>) → <a href="uuid.html">uuid</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows after the current row within its partition; if there is no such row, instead returns null. <code>n</code> is evaluated with respect to the current row.</p> 273 </span></td></tr> 274 <tr><td><a name="lead"></a><code>lead(val: <a href="uuid.html">uuid</a>, n: <a href="int.html">int</a>, default: <a href="uuid.html">uuid</a>) → <a href="uuid.html">uuid</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows after the current row within its partition; if there is no such, row, instead returns <code>default</code> (which must be of the same type as <code>val</code>). Both <code>n</code> and <code>default</code> are evaluated with respect to the current row.</p> 275 </span></td></tr> 276 <tr><td><a name="lead"></a><code>lead(val: geography) → geography</code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the following row within current row’s partition; if there is no such row, instead returns null.</p> 277 </span></td></tr> 278 <tr><td><a name="lead"></a><code>lead(val: geography, n: <a href="int.html">int</a>) → geography</code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows after the current row within its partition; if there is no such row, instead returns null. <code>n</code> is evaluated with respect to the current row.</p> 279 </span></td></tr> 280 <tr><td><a name="lead"></a><code>lead(val: geography, n: <a href="int.html">int</a>, default: geography) → geography</code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows after the current row within its partition; if there is no such, row, instead returns <code>default</code> (which must be of the same type as <code>val</code>). Both <code>n</code> and <code>default</code> are evaluated with respect to the current row.</p> 281 </span></td></tr> 282 <tr><td><a name="lead"></a><code>lead(val: geometry) → geometry</code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the following row within current row’s partition; if there is no such row, instead returns null.</p> 283 </span></td></tr> 284 <tr><td><a name="lead"></a><code>lead(val: geometry, n: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows after the current row within its partition; if there is no such row, instead returns null. <code>n</code> is evaluated with respect to the current row.</p> 285 </span></td></tr> 286 <tr><td><a name="lead"></a><code>lead(val: geometry, n: <a href="int.html">int</a>, default: geometry) → geometry</code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows after the current row within its partition; if there is no such, row, instead returns <code>default</code> (which must be of the same type as <code>val</code>). Both <code>n</code> and <code>default</code> are evaluated with respect to the current row.</p> 287 </span></td></tr> 288 <tr><td><a name="lead"></a><code>lead(val: jsonb) → jsonb</code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the following row within current row’s partition; if there is no such row, instead returns null.</p> 289 </span></td></tr> 290 <tr><td><a name="lead"></a><code>lead(val: jsonb, n: <a href="int.html">int</a>) → jsonb</code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows after the current row within its partition; if there is no such row, instead returns null. <code>n</code> is evaluated with respect to the current row.</p> 291 </span></td></tr> 292 <tr><td><a name="lead"></a><code>lead(val: jsonb, n: <a href="int.html">int</a>, default: jsonb) → jsonb</code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows after the current row within its partition; if there is no such, row, instead returns <code>default</code> (which must be of the same type as <code>val</code>). Both <code>n</code> and <code>default</code> are evaluated with respect to the current row.</p> 293 </span></td></tr> 294 <tr><td><a name="lead"></a><code>lead(val: oid) → oid</code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the following row within current row’s partition; if there is no such row, instead returns null.</p> 295 </span></td></tr> 296 <tr><td><a name="lead"></a><code>lead(val: oid, n: <a href="int.html">int</a>) → oid</code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows after the current row within its partition; if there is no such row, instead returns null. <code>n</code> is evaluated with respect to the current row.</p> 297 </span></td></tr> 298 <tr><td><a name="lead"></a><code>lead(val: oid, n: <a href="int.html">int</a>, default: oid) → oid</code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows after the current row within its partition; if there is no such, row, instead returns <code>default</code> (which must be of the same type as <code>val</code>). Both <code>n</code> and <code>default</code> are evaluated with respect to the current row.</p> 299 </span></td></tr> 300 <tr><td><a name="lead"></a><code>lead(val: timetz) → timetz</code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the following row within current row’s partition; if there is no such row, instead returns null.</p> 301 </span></td></tr> 302 <tr><td><a name="lead"></a><code>lead(val: timetz, n: <a href="int.html">int</a>) → timetz</code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows after the current row within its partition; if there is no such row, instead returns null. <code>n</code> is evaluated with respect to the current row.</p> 303 </span></td></tr> 304 <tr><td><a name="lead"></a><code>lead(val: timetz, n: <a href="int.html">int</a>, default: timetz) → timetz</code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows after the current row within its partition; if there is no such, row, instead returns <code>default</code> (which must be of the same type as <code>val</code>). Both <code>n</code> and <code>default</code> are evaluated with respect to the current row.</p> 305 </span></td></tr> 306 <tr><td><a name="lead"></a><code>lead(val: varbit) → varbit</code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the following row within current row’s partition; if there is no such row, instead returns null.</p> 307 </span></td></tr> 308 <tr><td><a name="lead"></a><code>lead(val: varbit, n: <a href="int.html">int</a>) → varbit</code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows after the current row within its partition; if there is no such row, instead returns null. <code>n</code> is evaluated with respect to the current row.</p> 309 </span></td></tr> 310 <tr><td><a name="lead"></a><code>lead(val: varbit, n: <a href="int.html">int</a>, default: varbit) → varbit</code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is <code>n</code> rows after the current row within its partition; if there is no such, row, instead returns <code>default</code> (which must be of the same type as <code>val</code>). Both <code>n</code> and <code>default</code> are evaluated with respect to the current row.</p> 311 </span></td></tr> 312 <tr><td><a name="nth_value"></a><code>nth_value(val: <a href="bool.html">bool</a>, n: <a href="int.html">int</a>) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is the <code>n</code>th row of the window frame (counting from 1); null if no such row.</p> 313 </span></td></tr> 314 <tr><td><a name="nth_value"></a><code>nth_value(val: <a href="bytes.html">bytes</a>, n: <a href="int.html">int</a>) → <a href="bytes.html">bytes</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is the <code>n</code>th row of the window frame (counting from 1); null if no such row.</p> 315 </span></td></tr> 316 <tr><td><a name="nth_value"></a><code>nth_value(val: <a href="date.html">date</a>, n: <a href="int.html">int</a>) → <a href="date.html">date</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is the <code>n</code>th row of the window frame (counting from 1); null if no such row.</p> 317 </span></td></tr> 318 <tr><td><a name="nth_value"></a><code>nth_value(val: <a href="decimal.html">decimal</a>, n: <a href="int.html">int</a>) → <a href="decimal.html">decimal</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is the <code>n</code>th row of the window frame (counting from 1); null if no such row.</p> 319 </span></td></tr> 320 <tr><td><a name="nth_value"></a><code>nth_value(val: <a href="float.html">float</a>, n: <a href="int.html">int</a>) → <a href="float.html">float</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is the <code>n</code>th row of the window frame (counting from 1); null if no such row.</p> 321 </span></td></tr> 322 <tr><td><a name="nth_value"></a><code>nth_value(val: <a href="inet.html">inet</a>, n: <a href="int.html">int</a>) → <a href="inet.html">inet</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is the <code>n</code>th row of the window frame (counting from 1); null if no such row.</p> 323 </span></td></tr> 324 <tr><td><a name="nth_value"></a><code>nth_value(val: <a href="int.html">int</a>, n: <a href="int.html">int</a>) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is the <code>n</code>th row of the window frame (counting from 1); null if no such row.</p> 325 </span></td></tr> 326 <tr><td><a name="nth_value"></a><code>nth_value(val: <a href="interval.html">interval</a>, n: <a href="int.html">int</a>) → <a href="interval.html">interval</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is the <code>n</code>th row of the window frame (counting from 1); null if no such row.</p> 327 </span></td></tr> 328 <tr><td><a name="nth_value"></a><code>nth_value(val: <a href="string.html">string</a>, n: <a href="int.html">int</a>) → <a href="string.html">string</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is the <code>n</code>th row of the window frame (counting from 1); null if no such row.</p> 329 </span></td></tr> 330 <tr><td><a name="nth_value"></a><code>nth_value(val: <a href="time.html">time</a>, n: <a href="int.html">int</a>) → <a href="time.html">time</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is the <code>n</code>th row of the window frame (counting from 1); null if no such row.</p> 331 </span></td></tr> 332 <tr><td><a name="nth_value"></a><code>nth_value(val: <a href="timestamp.html">timestamp</a>, n: <a href="int.html">int</a>) → <a href="timestamp.html">timestamp</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is the <code>n</code>th row of the window frame (counting from 1); null if no such row.</p> 333 </span></td></tr> 334 <tr><td><a name="nth_value"></a><code>nth_value(val: <a href="timestamp.html">timestamptz</a>, n: <a href="int.html">int</a>) → <a href="timestamp.html">timestamptz</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is the <code>n</code>th row of the window frame (counting from 1); null if no such row.</p> 335 </span></td></tr> 336 <tr><td><a name="nth_value"></a><code>nth_value(val: <a href="uuid.html">uuid</a>, n: <a href="int.html">int</a>) → <a href="uuid.html">uuid</a></code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is the <code>n</code>th row of the window frame (counting from 1); null if no such row.</p> 337 </span></td></tr> 338 <tr><td><a name="nth_value"></a><code>nth_value(val: geography, n: <a href="int.html">int</a>) → geography</code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is the <code>n</code>th row of the window frame (counting from 1); null if no such row.</p> 339 </span></td></tr> 340 <tr><td><a name="nth_value"></a><code>nth_value(val: geometry, n: <a href="int.html">int</a>) → geometry</code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is the <code>n</code>th row of the window frame (counting from 1); null if no such row.</p> 341 </span></td></tr> 342 <tr><td><a name="nth_value"></a><code>nth_value(val: jsonb, n: <a href="int.html">int</a>) → jsonb</code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is the <code>n</code>th row of the window frame (counting from 1); null if no such row.</p> 343 </span></td></tr> 344 <tr><td><a name="nth_value"></a><code>nth_value(val: oid, n: <a href="int.html">int</a>) → oid</code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is the <code>n</code>th row of the window frame (counting from 1); null if no such row.</p> 345 </span></td></tr> 346 <tr><td><a name="nth_value"></a><code>nth_value(val: timetz, n: <a href="int.html">int</a>) → timetz</code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is the <code>n</code>th row of the window frame (counting from 1); null if no such row.</p> 347 </span></td></tr> 348 <tr><td><a name="nth_value"></a><code>nth_value(val: varbit, n: <a href="int.html">int</a>) → varbit</code></td><td><span class="funcdesc"><p>Returns <code>val</code> evaluated at the row that is the <code>n</code>th row of the window frame (counting from 1); null if no such row.</p> 349 </span></td></tr> 350 <tr><td><a name="ntile"></a><code>ntile(n: <a href="int.html">int</a>) → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Calculates an integer ranging from 1 to <code>n</code>, dividing the partition as equally as possible.</p> 351 </span></td></tr> 352 <tr><td><a name="percent_rank"></a><code>percent_rank() → <a href="float.html">float</a></code></td><td><span class="funcdesc"><p>Calculates the relative rank of the current row: (rank - 1) / (total rows - 1).</p> 353 </span></td></tr> 354 <tr><td><a name="rank"></a><code>rank() → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Calculates the rank of the current row with gaps; same as row_number of its first peer.</p> 355 </span></td></tr> 356 <tr><td><a name="row_number"></a><code>row_number() → <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Calculates the number of the current row within its partition, counting from 1.</p> 357 </span></td></tr></tbody> 358 </table> 359