<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Vertica Documentation – Window clauses</title>
    <link>/en/sql-reference/language-elements/window-clauses/</link>
    <description>Recent content in Window clauses on Vertica Documentation</description>
    <generator>Hugo -- gohugo.io</generator>
    
	  <atom:link href="/en/sql-reference/language-elements/window-clauses/index.xml" rel="self" type="application/rss+xml" />
    
    
      
        
      
    
    
    <item>
      <title>Sql-Reference: Window partition clause</title>
      <link>/en/sql-reference/language-elements/window-clauses/window-partition-clause/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/language-elements/window-clauses/window-partition-clause/</guid>
      <description>
        
        
        &lt;p&gt;When specified, a window partition clause divides the rows of the function input based on user-provided expressions. If no expression is provided, the partition clause can improve query performance by using parallelism. If you omit specifying a window partition clause, all input rows are treated as a single partition.&lt;/p&gt;
&lt;p&gt;Window partitioning is similar to the GROUP BY clause; however, PARTITION BEST and PARTITION NODES may only be used with analytic functions and return only one result per input row, while PARTITION ROW can be used for single-phase transform functions and returns multiple values per input row.&lt;/p&gt;
&lt;p&gt;When used with analytic functions, results are computed per partition and start over again (reset) at the beginning of each subsequent partition.&lt;/p&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;{ PARTITION BY &lt;span class=&#34;code-variable&#34;&gt;expression&lt;/span&gt;[,...] | PARTITION BEST | PARTITION NODES | PARTITION ROW }
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;

&lt;table class=&#34;table table-bordered&#34; &gt;



&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;PARTITION BY &lt;/code&gt;&lt;em&gt;&lt;code&gt;expression&lt;/code&gt;&lt;/em&gt;&lt;/td&gt; 

&lt;td &gt;
Expression on which to sort the partition, where &lt;em&gt;&lt;code&gt;expression&lt;/code&gt;&lt;/em&gt; can be a column, constant, or an arbitrary expression formed on columns. Use &lt;code&gt;PARTITION BY&lt;/code&gt; for functions with specific partitioning requirements.&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;PARTITION BEST&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;










&lt;p&gt;Use parallelism to improve performance for multi-threaded queries across multiple nodes.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;OVER(PARTITION BEST)&lt;/code&gt; provides the best performance on multi-threaded queries across multiple nodes.&lt;/p&gt;
&lt;p&gt;The following considerations apply to using &lt;code&gt;PARTITION BEST&lt;/code&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Use &lt;code&gt;PARTITION BEST&lt;/code&gt; for analytic functions that have no partitioning requirements and are thread safe—for example, a one-to-many transform.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Do not use &lt;code&gt;PARTITION BEST&lt;/code&gt; on user-defined transform functions (UDTFs) that are not thread-safe. Doing so can produce an error or incorrect results. If a UDTF is not thread safe, use &lt;code&gt;PARTITION NODES&lt;/code&gt; .&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;PARTITION NODES&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;




&lt;p&gt;Use parallelism to improve performance for single-threaded queries across multiple nodes.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;OVER(PARTITION NODES)&lt;/code&gt; provides the best performance on single-threaded queries across multiple nodes.&lt;/p&gt;
&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;PARTITION ROW&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;




&lt;p&gt;Use to feed input partitions of exactly one row. If used, any arbitrary expression may be used in the query target list alongside the UDTF.&lt;/p&gt;
&lt;p&gt;May not be used for analytic functions or multi-phase transform functions. Note that only one PARTITION ROW transform function is allowed in the target list for each level of the query.&lt;/p&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;

&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;p&gt;See &lt;a href=&#34;../../../../en/data-analysis/sql-analytics/window-partitioning/&#34;&gt;Window partitioning&lt;/a&gt;.&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Sql-Reference: Window order clause</title>
      <link>/en/sql-reference/language-elements/window-clauses/window-order-clause/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/language-elements/window-clauses/window-order-clause/</guid>
      <description>
        
        
        &lt;p&gt;Specifies how to sort rows that are supplied to an analytic function. If the OVER clause also includes a &lt;a href=&#34;../../../../en/sql-reference/language-elements/window-clauses/window-partition-clause/&#34;&gt;window partition clause&lt;/a&gt;, rows are sorted within each partition.&lt;/p&gt;
&lt;p&gt;The window order clause only specifies order within a window result set. The query can have its own &lt;a href=&#34;../../../../en/sql-reference/statements/select/order-by-clause/&#34;&gt;ORDER BY&lt;/a&gt; clause outside the OVER clause. This has precedence over the window order clause and orders the final result set.&lt;/p&gt;
&lt;p&gt;A window order clause also creates a default &lt;a href=&#34;../../../../en/sql-reference/language-elements/window-clauses/window-frame-clause/&#34;&gt;window frame&lt;/a&gt; if none is explicitly specified.&lt;/p&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;ORDER BY { &lt;span class=&#34;code-variable&#34;&gt;expression&lt;/span&gt; [ ASC | DESC [ NULLS { FIRST | LAST | AUTO } ] ]
  }[,...]
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;

&lt;table class=&#34;table table-bordered&#34; &gt;



&lt;tr&gt; 

&lt;td &gt;
&lt;em&gt;&lt;code&gt;expression&lt;/code&gt;&lt;/em&gt;&lt;/td&gt; 

&lt;td &gt;
A column, constant, or arbitrary expression formed on columns on which to sort input rows.&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;ASC | DESC&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
Specifies the ordering sequence as ascending (default) or descending.&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;NULLS {FIRST | LAST | AUTO}&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
















&lt;p&gt;Specifies whether to position null values first or last. Default positioning depends on whether the sort order is ascending or descending:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Ascending default: &lt;code&gt;NULLS LAST&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Descending default: &lt;code&gt;NULLS FIRST&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you specify &lt;code&gt;NULLS AUTO&lt;/code&gt;, Vertica chooses the positioning that is most efficient for this query, either &lt;code&gt;NULLS FIRST&lt;/code&gt; or &lt;code&gt;NULLS LAST&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;If you omit all sort qualifiers, Vertica uses &lt;code&gt;ASC NULLS LAST&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;For more information, see:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;../../../../en/data-analysis/query-optimization/analytic-functions/null-sort-order/&#34;&gt;NULL sort order&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;../../../../en/data-analysis/query-optimization/analytic-functions/runtime-sorting-of-null-values-analytic-functions/&#34;&gt;Runtime sorting of NULL values in analytic functions&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;

&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;p&gt;See &lt;a href=&#34;../../../../en/data-analysis/sql-analytics/window-ordering/&#34;&gt;Window ordering&lt;/a&gt;.&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Sql-Reference: Window frame clause</title>
      <link>/en/sql-reference/language-elements/window-clauses/window-frame-clause/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/language-elements/window-clauses/window-frame-clause/</guid>
      <description>
        
        
        &lt;p&gt;Specifies a window frame, which comprises a set of rows relative to the row that is currently being evaluated by an analytic function. After the function processes that row and its window, Vertica advances the current row and adjusts the window boundaries accordingly. If the OVER clause also specifies a &lt;a href=&#34;../../../../en/sql-reference/language-elements/window-clauses/window-partition-clause/&#34;&gt;partition&lt;/a&gt;, Vertica also checks that window boundaries do not cross partition boundaries. This process repeats until the function evaluates the last row of the last partition.&lt;/p&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;{ ROWS | RANGE } { BETWEEN &lt;span class=&#34;code-variable&#34;&gt;start‑point&lt;/span&gt; AND &lt;span class=&#34;code-variable&#34;&gt;end‑point&lt;/span&gt; } | &lt;span class=&#34;code-variable&#34;&gt;start‑point&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;&lt;code&gt;start-point&lt;/code&gt;&lt;/em&gt; / &lt;em&gt;&lt;code&gt;end‑point&lt;/code&gt;&lt;/em&gt;:&lt;/strong&gt;&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;{ UNBOUNDED {PRECEDING | FOLLOWING}
  | CURRENT ROW
  | &lt;span class=&#34;code-variable&#34;&gt;constant-value&lt;/span&gt;  {PRECEDING | FOLLOWING}}
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;

&lt;table class=&#34;table table-bordered&#34; &gt;



&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;ROWS | RANGE&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Specifies whether Vertica determines window frame dimensions as physical or logical offsets from the current row. See &lt;a href=&#34;#ROWSversusRANGE&#34;&gt;ROWS versus RANGE&lt;/a&gt; below for details.&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;BETWEEN &lt;/code&gt;&lt;em&gt;&lt;code&gt;start‑point&lt;/code&gt;&lt;/em&gt;&lt;code&gt;AND&lt;/code&gt;&lt;em&gt;&lt;code&gt;end‑point&lt;/code&gt;&lt;/em&gt;&lt;/td&gt; 

&lt;td &gt;










&lt;p&gt;Specifies the window&#39;s first and last rows, where &lt;em&gt;&lt;code&gt;start‑point&lt;/code&gt;&lt;/em&gt; and &lt;em&gt;&lt;code&gt;end‑point&lt;/code&gt;&lt;/em&gt; can be one of the following (discussed in detail below):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;UNBOUNDED {PRECEDING | FOLLOWING}&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;CURRENT ROW&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;&lt;code&gt;constant-value&lt;/code&gt;&lt;/em&gt; &lt;code&gt;{PRECEDING | FOLLOWING}&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;em&gt;&lt;code&gt;start‑point&lt;/code&gt;&lt;/em&gt; must resolve to a row or value that is less than or equal to &lt;em&gt;&lt;code&gt;end‑point&lt;/code&gt;&lt;/em&gt;.&lt;/p&gt;
&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;UNBOUNDED PRECEDING&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Specifies that the window frame extends to the current partition&#39;s first row.&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;em&gt;&lt;code&gt;start‑point&lt;/code&gt;&lt;/em&gt;&lt;/td&gt; 

&lt;td &gt;
If &lt;code&gt;ROWS&lt;/code&gt; or &lt;code&gt;RANGE&lt;/code&gt; specifies only a start point, Vertica uses the current row as the end point and creates the window frame accordingly. In this case, &lt;em&gt;&lt;code&gt;start-point&lt;/code&gt;&lt;/em&gt; must resolve to a row that is less than or equal to the current row.&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;UNBOUNDED FOLLOWING&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Specifies that the window frame extends to the current partition&#39;s last row.&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;CURRENT ROW&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Specifies the current row or value as the window&#39;s start or end point.&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;em&gt;&lt;code&gt;constant‑value&lt;/code&gt;&lt;/em&gt;&lt;code&gt; {PRECEDING | FOLLOWING}&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;




&lt;p&gt;Specifies a constant value or expression that evaluates to a constant value. The value specifies a physical or logical offset from the current row, depending on whether you specify &lt;code&gt;ROWS&lt;/code&gt; or &lt;code&gt;RANGE&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Other dependencies also pertain, depending whether you specify &lt;code&gt;ROWS&lt;/code&gt; and &lt;code&gt;RANGE&lt;/code&gt;. See &lt;a href=&#34;#ROWSversusRANGE&#34;&gt;ROWS versus RANGE&lt;/a&gt; below for details.&lt;/p&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;

&lt;h2 id=&#34;requirements&#34;&gt;Requirements&lt;/h2&gt;
&lt;p&gt;In order to specify a window frame, the &lt;code&gt;OVER&lt;/code&gt; must also specify a &lt;a href=&#34;../../../../en/sql-reference/language-elements/window-clauses/window-order-clause/&#34;&gt;window order (ORDER BY) clause&lt;/a&gt;. If the OVER clause omits specifying a window frame, the function creates a default window that extends from the current row to the first row in the current partition. This is equivalent to the following clause:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;RANGE UNBOUNDED PRECEDING AND CURRENT ROW
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;a name=&#34;ROWSversusRANGE&#34;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&#34;rows-versus-range&#34;&gt;ROWS versus RANGE&lt;/h2&gt;
&lt;p&gt;The window frame&#39;s offset from the current row can be physical or logical:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;ROWS&lt;/code&gt; specifies the window&#39;s &lt;em&gt;&lt;code&gt;start‑point&lt;/code&gt;&lt;/em&gt; and &lt;em&gt;&lt;code&gt;end‑point&lt;/code&gt;&lt;/em&gt; as a number of rows relative to the current row. If &lt;em&gt;&lt;code&gt;start‑point&lt;/code&gt;&lt;/em&gt; and &lt;em&gt;&lt;code&gt;end‑point&lt;/code&gt;&lt;/em&gt; are expressed as constant values, the value must evaluate to a positive integer.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;RANGE&lt;/code&gt; specifies the window as a logical offset such as time. The range value must match the &lt;a href=&#34;../../../../en/sql-reference/language-elements/window-clauses/window-order-clause/&#34;&gt;window order (ORDER BY) clause&lt;/a&gt; data type: NUMERIC, DATE/TIME, FLOAT or INTEGER.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Use of &lt;code&gt;ROWS&lt;/code&gt; or &lt;code&gt;RANGE&lt;/code&gt; imposes specific requirements on setting the window&#39;s start and end points as constant values. When setting constant values for &lt;code&gt;ROWS&lt;/code&gt;, the constant must evaluate to a positive INTEGER.&lt;/p&gt;
&lt;p&gt;When setting constant values for &lt;code&gt;RANGE&lt;/code&gt;, the following requirements apply:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The constant must evaluate to a positive numeric value or INTERVAL literal.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;If the constant evaluates to a NUMERIC value, the ORDER BY column type must be a NUMERIC data type.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;If the constant evaluates to an INTERVAL DAY TO SECOND subtype, the ORDER BY column type must be one of the following: TIMESTAMP, TIME, DATE, or INTERVAL DAY TO SECOND.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;If the constant evaluates to an INTERVAL YEAR TO MONTH, the ORDER BY column type must be one of the following: TIMESTAMP, DATE, or INTERVAL YEAR TO MONTH.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;a href=&#34;../../../../en/sql-reference/language-elements/window-clauses/window-order-clause/&#34;&gt;window order clause&lt;/a&gt; can specify only one expression.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;p&gt;See &lt;a href=&#34;../../../../en/data-analysis/sql-analytics/window-framing/&#34;&gt;Window framing&lt;/a&gt;.&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Sql-Reference: Window name clause</title>
      <link>/en/sql-reference/language-elements/window-clauses/window-name-clause/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/language-elements/window-clauses/window-name-clause/</guid>
      <description>
        
        
        &lt;p&gt;Defines a named window that specifies window partition and order clauses for an analytic function. This window is specified in the function&#39;s &lt;code&gt;OVER&lt;/code&gt; clause. Named windows can be useful when you write queries that invoke multiple analytic functions with similar &lt;code&gt;OVER&lt;/code&gt; clauses—for example, they use the same partition (&lt;code&gt;PARTITION BY&lt;/code&gt;) clauses.&lt;/p&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;WINDOW &lt;span class=&#34;code-variable&#34;&gt;window-name&lt;/span&gt; AS ( &lt;span class=&#34;code-variable&#34;&gt;window-partition-clause&lt;/span&gt; [&lt;span class=&#34;code-variable&#34;&gt;window-order-clause&lt;/span&gt;] )
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;

&lt;table class=&#34;table table-bordered&#34; &gt;



&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;WINDOW &lt;/code&gt;&lt;em&gt;&lt;code&gt;window‑name&lt;/code&gt;&lt;/em&gt;&lt;/td&gt; 

&lt;td &gt;
Specifies the window name. All window names must be unique within the same query.&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;

&lt;code&gt;&lt;span class=&#34;code-variable&#34;&gt;&lt;a href=&#34;../../../../en/sql-reference/language-elements/window-clauses/window-partition-clause/&#34;&gt;window‑partition‑clause&lt;/a&gt;&lt;/span&gt; [&lt;span class=&#34;code-variable&#34;&gt;&lt;a href=&#34;../../../../en/sql-reference/language-elements/window-clauses/window-order-clause/&#34;&gt;window‑order‑clause&lt;/a&gt;&lt;/span&gt;]&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;




&lt;p&gt;Clauses to invoke when an &lt;code&gt;OVER&lt;/code&gt; clause references this window.&lt;/p&gt;
&lt;p&gt;If the window definition omits a &lt;a href=&#34;../../../../en/sql-reference/language-elements/window-clauses/window-order-clause/&#34;&gt;window order clause&lt;/a&gt;, the &lt;code&gt;OVER&lt;/code&gt; clause can specify its own order clause.&lt;/p&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;

&lt;h2 id=&#34;requirements&#34;&gt;Requirements&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;A &lt;code&gt;WINDOW&lt;/code&gt; clause cannot include a &lt;a href=&#34;../../../../en/data-analysis/sql-analytics/window-framing/&#34;&gt;window frame clause&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Each &lt;code&gt;WINDOW&lt;/code&gt; clause within the same query must have a unique name.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;A &lt;code&gt;WINDOW&lt;/code&gt; clause can reference another window that is already named. For example, the following query names window &lt;code&gt;w1&lt;/code&gt; before &lt;code&gt;w2&lt;/code&gt;. Thus, the &lt;code&gt;WINDOW&lt;/code&gt; clause that defines &lt;code&gt;w2&lt;/code&gt; can reference &lt;code&gt;w1&lt;/code&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT RANK() OVER(w1 ORDER BY sal DESC), RANK() OVER w2
   FROM EMP WINDOW w1 AS (PARTITION BY deptno), w2 AS (w1 ORDER BY sal);
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;p&gt;See &lt;a href=&#34;../../../../en/data-analysis/sql-analytics/named-windows/&#34;&gt;Named windows&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;

Analytic Functions

      </description>
    </item>
    
  </channel>
</rss>
