Training
Module
Write queries that use window functions - Training
This content is a part of Write queries that use window functions.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
slice
functionApplies to: Databricks SQL
Databricks Runtime
Returns a subset of an array.
slice(expr, start, length)
expr
: An ARRAY
expression.start
: An INTEGER
expression.length
: An INTEGER
expression that is greater or equal to 0.The result is of the type of expr
.
The function subsets array expr
starting from index start
(array indices start at 1), or starting from the end if start
is negative, with the specified length
.
If the requested array slice does not overlap with the actual length of the array, an empty array is returned.
> SELECT slice(array(1, 2, 3, 4), 2, 2);
[2,3]
> SELECT slice(array(1, 2, 3, 4), -2, 2);
[3,4]
Training
Module
Write queries that use window functions - Training
This content is a part of Write queries that use window functions.
Documentation
GROUP BY clause - Azure Databricks - Databricks SQL
Learn how to use the GROUP BY syntax of the SQL language in Databricks SQL.
cube function - Azure Databricks - Databricks SQL
Learn the syntax of the cube function of the SQL language in Databricks SQL and Databricks Runtime.
window grouping expression - Azure Databricks - Databricks SQL
Learn the syntax of the window grouping expression of the SQL language in Databricks SQL and Databricks Runtime.