C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
MySQL SUBSTRING_INDEX() FunctionThe 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. Syntaxselect substring_index(str, delim, count); 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 1Select substring_index('www.TheDeveloperBlog.com','.',3); Output: Example 2Select substring_index('www.TheDeveloperBlog.com','.',2); Output: Example 3Select substring_index('www.TheDeveloperBlog.com','.',1); Output: Example 4Select substring_index('www.TheDeveloperBlog.com','.',-1); Output: Example 5Select substring_index('www.TheDeveloperBlog.com','.',-2); Output:
Next TopicMySQL String
|