Categories: String
SUBSTRING
Returns the portion of the string from the specified base expression starting at the specified characters.
Syntax
SUBSTRING(string_expression varchar, offset int64) → varchar
- string_expression: Base expression to extract substring from.
- offset: The offset from which the substring starts.
Examples
SUBSTRING exampleSELECT SUBSTRING('dremio user 1 2 3', 12)
-- 1 2 3
SUBSTRING(string_expression varchar FROM offset int64) → varchar
- string_expression: Base expression to extract substring from.
- offset: The offset from which the substring starts.
Examples
SUBSTRING exampleSELECT SUBSTRING('dremio user 1 2 3' FROM 12)
-- 1 2 3
SUBSTRING(string_expression varchar, offset int64, length int64) → varchar
- string_expression: Base expression to extract substring from.
- offset: The offset from which the substring starts.
- length (optional): The length limit of the substring.
Examples
SUBSTRING exampleSELECT SUBSTRING('base expression', 6, 4)
-- expr
Usage Notes
This function is similar to SUBSTR
except that this function can accept the FROM
clause.