SUBSTRING function

SUBSTRING returns a specified substring of a string.

Signatures

substring ( str , start_pos , len )
Parameter Type Description
str string The base string.
start_pos int The starting position for the substring; counting starts at 1.
len int The length of the substring you want to return.

Return value

substring returns a string.

Examples

SELECT substring('abcdefg', 3) AS substr;
 substr
--------
 cdefg

SELECT substring('abcdefg', 3, 3) AS substr;
 substr
--------
 cde
Back to top ↑