The FIELD function returns the index (position) of string arguments (str1, str2, str3, ...)
It returns 0 if the str value is not found.
If each argument is a string, all arguments will be compared as strings, whereas if arguments are numbers, they will be compared as numbers.
Otherwise, the arguments are compared as double.
If str is NULL, the return value is 0 because NULL fails equality comparison with any value. FIELD() is the complement of ELT().
SELECT FIELD('ej', 'Hej', 'ej', 'Heja', 'hej', 'foo');
Returns 2
SELECT FIELD('fo', 'Hej', 'ej', 'Heja', 'hej', 'foo');
Returns 0
Return the index position of the first argument within the second argument
SELECT FIND_IN_SET('2', '1,2,3,4');
-> 2
SELECT FIND_IN_SET('1', '123');
-> 0
INSTR(str, substr) returns the index of the first occurrence of substring str in string substr. Note that this works like LOCATE except the order of the arguments is reversed:
SELECT INSTR('tacosalad', 'salad');
-> 5
SELECT INSTR('burger', 'salad');
-> 0
Return the leftmost number of characters as specified
SELECT LEFT('drizzled', 7);
-> 'drizzle'
This function inserts a substring at the specified position up to the specified number of characters.
INSERT(str,pos,len,newstr)
It returns str (a string), with the substring beginning at pos (position) and len (how many characters long) replaced by the newstr.
SELECT INSERT('Aquatic', 3, 2, 'Me');
-> 'AqMetic'
SELECT INSERT('Aquatic', -1, 4, 'This');
-> 'Aquatic'
SELECT INSERT('Aquatic', 3, 100, 'This');
-> 'AqThis'
Return the position of the first occurrence of substring.
SELECT LOCATE('salad', 'tacosalad');
-> 5
SELECT LOCATE('burger', 'salad');
-> 0
A synonym for LOCATE()