substring

Returns the substring of "string_expression" that starts at position "integer_expression1" for "integer_expression2" characters or to the end of "string_expression" if "integer_expression2" is omitted. The first character in "string_expression" is at position 1.

Syntax

substring ( string_expression , integer_expression1 [ ,
 integer_expression2 ] )

Example

substring ( 'abcdefg' , 3 , 2 )

Result

cd