SUBSTRING

The string function used to extract a substring from a string, given a starting index (1-based) and an optional length.

Parameter Type Description
str
string
the string to extract from
start
integer
the position of the first character to extract
length
integer
the length of thing to extract
Returns: string

Example

query:

SELECT SUBSTRING("Amaryllis", 4, 3)

results:

substring
ryl

The SUBSTRINGfunction requires two arguments and can take a third. The first argument is the string to be found and it can be stated either as a string or as a column. The second argument is the placement in the string of the first character to be returned. The third (optional) argument is the number of characters to be returned. If the third argument is omitted, the query returns all of the string from the first returned character on.