MySQL SUBSTRING_INDEX() Function

The substring_index() is a String function of MySQL. This function returns a substring from the given string(str) before the counts come of the delimiter.

Syntax

Parameter:

str: main string

delim: string to be searched

count: number of times to search delim

Returns:

This function returns the substring of the string before a number of occurrences of delimiter.

Example 1

Output:


MySQL String SUBSTRING_INDEX() Function

Example 2

Output:


MySQL String SUBSTRING_INDEX() Function

Example 3

Output:


MySQL String SUBSTRING_INDEX() Function

Example 4

Output:


MySQL String SUBSTRING_INDEX() Function

Example 5

Output:


MySQL String SUBSTRING_INDEX() Function
Next TopicMySQL String




Latest Courses