SQL Reference
...
SQL Functions
String Functions
STRPOS
7min
The STRPOS() is used to return the position from where the substring (the second argument) is matched with the string (the first argument).

The input and return must be of type string.
š”Special cases:
- Returns NULL if there are no input rows or NULL values.
- If the substring is not found in the string, then the STRPOS() function will return 0.
In the example below, we will find the ut (substring) position in the computer (string):

We can see that ut is located at the fifth character of the computer:

We have a listofwords table where it stores the word data.


The above query will show the following table:

The following query will display the words and a position of a specific substring = āalā using the STRPOS() function:

The result will display the al position of different words: