startswith
function
Applies to: Databricks SQL Databricks Runtime 10.4 LTS and above
Returns true
if expr
begins with startExpr
.
Syntax
startswith(expr, startExpr)
Arguments
expr
: ASTRING
expression.startExpr
: ASTRING
expression that is compared to the start ofstr
.
Returns
A BOOLEAN
.
If expr
or startExpr
is NULL
, the result is NULL
.
If startExpr
is the empty string or empty binary the result is true
.
Applies to: Databricks SQL Databricks Runtime 11.3 LTS and above
The function operates in BINARY
mode if both arguments are BINARY
.
Examples
> SELECT startswith('SparkSQL', 'Spark');
true
> SELECT startswith('SparkSQL', 'spark');
false
> SELECT startswith('SparkSQL', NULL);
NULL
> SELECT startswith(NULL, 'Spark');
NULL
> SELECT startswith('SparkSQL', '');
true
Related
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for