This tutorial explains how to use the MySQL SUBSTR function with syntax and examples.
The MySQL SUBSTR function allows you to extract a substring from a string.
The syntax for the SUBSTR function in MySQL is:
OR
The source string.
The position for extraction. The first position in the string is always 1.
Optional. It is the number of characters to extract. If this parameter is omitted, the SUBSTR function will return the entire string.
The SUBSTR function can be used in the following versions of MySQL:
Let's look at some MySQL SUBSTR function examples and explore how to use the SUBSTR function in MySQL.
For example: