The
SUBSTRING
Function
The SUBSTRING function extracts a substring from a string.
Syntax
SUBSTRING(string, start, length)
This function operates on the input string and extracts a substring starting at position start that is
length characters long. For example, the following code returns the output ‘abc’.
SELECT SUBSTRING('abcde', 1, 3);
If the value of the third argument exceeds the end of the input string, the function returns every-
thing until the end without raising an error. This can be convenient when you want to return every-
thing from a certain point until the end of the string—you can simply specify the maximum length of
the data type or a value representing the full length of the input string.
Do'stlaringiz bilan baham: |