Overview
TheSTRPOS()
is used to return the position from where the substring (the second argument) is matched with the string (the first argument).
string
.
Special cases:
- Returns
NULL
if there are no input rows orNULL
values. - If the
substring
is not found in the string, then theSTRPOS()
function will return 0.
Examples
Case 1: Basic STRPOS()
function
In the example below, we will find the ut (substring) position in the computer (string):
Case 2: STRPOS() function using column
We have a listofwords table where it stores the word data.STRPOS()
function: