In this PostgreSQL post explains how to use the PostgreSQL substring function with syntax and examples.
The PostgreSQL substring function allows you to extract a substring from a string.
The syntax for the substring function in PostgreSQL is:
The source string.
Optional. It is the starting position for extraction. If this parameter is omitted, the substring function will start at position 1 (which is the first position in the string).
Optional. It is the number of characters to extract. If this parameter is omitted, the substring function will return the entire string (from the start_position to the end of the string).
The substring function can be used in the following versions of PostgreSQL:
Let's look at some PostgreSQL substring function examples and explore how to use the substring function in PostgreSQL.
For example: