LPAD
Declaration
LPAD(str,len,padstr)
Description
The LPAD function pads the string str on the left with the string padstr until the length of the string is len.
If the length of str is greater than len, the function returns the leftmost len characters of str. If the length of str is less than len and the concatenation of padstr and str exceeds len, the function returns the rightmost len characters of the concatenation.
Examples
SELECT LPAD('Base',9,'Ocean');
+------------------------+
| LPAD('Base',9,'Ocean') |
+------------------------+
| OceanBase |
+------------------------+
1 row in set (0.001 sec)
SELECT LPAD('Base',1,'Ocean');
+------------------------+
| LPAD('Base',1,'Ocean') |
+------------------------+
| B |
+------------------------+
1 row in set (0.000 sec)