# When MySQL SUBSTRING_INDEX() function returns the same string, provided in the argument, as output?

MySQL SUBSTRING_INDEX() function will return the same string as output if the argument ‘count’ has the value greater than the total number of occurrences of delimiter. It can be demonstrated with the following example −

mysql> Select SUBSTRING_INDEX('www.google.co.in','.',4);
+-------------------------------------------+
+-------------------------------------------+
+-------------------------------------------+
1 row in set (0.00 sec)

The above query returns the same string because 4 is greater than the total number of occurrences of delimiter provided as argument i.e. ‘.’.

Lakshmi Srinivas

Programmer / Analyst / Technician