HTML tutorial
CSS3 tutorial
Bootstrap tutorial
JavaScript tutorial
JQuery tutorial
AngularJS tutorial
React tutorial
NodeJS tutorial
PHP tutorial
Python tutorial
Python3 tutorial
Django tutorial
Linux tutorial
Docker tutorial
Ruby tutorial
Java tutorial
C tutorial
C ++ tutorial
Perl tutorial
JSP tutorial
Lua tutorial
Scala tutorial
Go tutorial
ASP.NET tutorial
C # tutorial
MySQL Functions : Search for "3" in string "W3C", and return position
The POSITION() function returns the position of the first occurrence of a substring in a string.
If the substring is not found within the original string, this function returns 0.
This function performs a case-insensitive search.
POSITION(substring IN string)
Parameter | Description |
---|---|
substring | Required. The substring to search for in string |
string | Required. The original string that will be searched |
Works in: | From MySQL 4.0 |
---|
Search for "COM" in string "W3C", and return position:
SELECT POSITION("COM" IN "W3C") AS MatchPosition;
Search for "a" in CustomerName column, and return position:
SELECT POSITION("a" IN CustomerName)
FROM Customers;