The syntax of SUBSTRING() function using FROM and FOR keywords is the standard MySQL syntax.
Syntax
SUBSTRING(str FROM pos FOR len)
Here,
- str is the string from which substring would be returned.
- Pos is the starting position of substring.
- Len is the length of substring i.e. the total number of characters fetched from str.
Example
mysql> Select SUBSTRING('foobarbar' FROM 4 FOR 5); +-------------------------------------+ | SUBSTRING('foobarbar' FROM 4 FOR 5) | +-------------------------------------+ | barba | +-------------------------------------+ 1 row in set (0.00 sec)
The result set above, makes the use of FROM and FOR keywords very much clear in SUBSTRING() function.