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: ASTRINGexpression.startExpr: ASTRINGexpression 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
SQL
> SELECT startswith('SparkSQL', 'Spark');
true
> SELECT startswith('SparkSQL', 'spark');
false
> SELECT startswith('SparkSQL', NULL);
NULL
> SELECT startswith(NULL, 'Spark');
NULL
> SELECT startswith('SparkSQL', '');
true