This tutorial explains how to use the MySQL SUBSTRING_INDEX function with syntax and examples.
The MySQL SUBSTRING_INDEX function returns the substring of string before number of occurrences of delimiter.
The syntax for the SUBSTRING_INDEX function in MySQL is:
The source string.
The delimiter to search for in string.
The number of times to search for delimiter.
The SUBSTRING_INDEX function can be used in the following versions of MySQL:
Let's look at some MySQL SUBSTRING_INDEX function examples and explore how to use the SUBSTRING_INDEX function in MySQL.
For example: