In this PostgreSQL post explains how to use the PostgreSQL position function with syntax and examples.
The PostgreSQL position function returns the location of a substring in a string.
The syntax for the position function in PostgreSQL is:
position( substring in string )
The substring to search for in string.
The string to search.
The position function can be used in the following versions of PostgreSQL:
Let's look at some PostgreSQL position function examples and explore how to use the position function in PostgreSQL.
For example:
postgres=# SELECT position('B' in 'AODBA.com');
position
----------
4
(1 row)
postgres=# SELECT position('Z' in 'AODBA.com');
position
----------
0
(1 row)