Search for "3" in string "91xjr.com", and return position:
SELECT INSTR("91xjr.com", "3") AS MatchPosition;
Try it Yourself »
The INSTR() function returns the position of the first occurrence of a string in another string.
This function performs a case-insensitive search.
INSTR(
string1,
string2)
Parameter | Description |
---|---|
string1 | Required. The string that will be searched |
string2 | Required. The string to search for in string1. If string2 is not found, this function returns 0 |
Works in: | From MySQL 4.0 |
---|
Search for "COM" in string "91xjr.com", and return position:
SELECT INSTR("91xjr.com", "COM") AS MatchPosition;
Try it Yourself »
Search for "a" in CustomerName column, and return position:
SELECT INSTR(CustomerName, "a")
FROM Customers;
Try it Yourself »
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!