HTML tutorial
CSS3 tutorial
Bootstrap tutorial
JavaScript tutorial
JQuery tutorial
AngularJS tutorial
React tutorial
NodeJS tutorial
PHP tutorial
Python tutorial
Python3 tutorial
Django tutorial
Linux tutorial
Docker tutorial
Ruby tutorial
Java tutorial
C tutorial
C ++ tutorial
Perl tutorial
JSP tutorial
Lua tutorial
Scala tutorial
Go tutorial
ASP.NET tutorial
C # tutorial
Return a substring of a string before a specified number of delimiter occurs
The SUBSTRING_INDEX() function returns a substring of a string before a specified number of delimiter occurs.
SUBSTRING_INDEX(string, delimiter, number)
Parameter | Description |
---|---|
string | Required. The original string |
delimiter | Required. The delimiter to search for |
number | Required. The number of times to search for the delimiter. Can be both a positive or negative number. If it is a positive number, this function returns all to the left of the delimiter. If it is a negative number, this function returns all to the right of the delimiter. |
Works in: | From MySQL 4.0 |
---|
Return a substring of a string before a specified number of delimiter occurs:
SELECT SUBSTRING_INDEX("W3C", ".", 2);