LPAD(str,len,padstr): Left-paded str with the string padstr to a length of len characters : LPAD « String Functions « MySQL Tutorial






If str is longer than len, the return value is shortened to len characters.

mysql>
mysql> SELECT LPAD('ABC',4,'??');
+--------------------+
| LPAD('ABC',4,'??') |
+--------------------+
| ?ABC               |
+--------------------+
1 row in set (0.00 sec)

mysql>
mysql> SELECT LPAD('ABC',1,'??');
+--------------------+
| LPAD('ABC',1,'??') |
+--------------------+
| A                  |
+--------------------+
1 row in set (0.00 sec)

mysql>
mysql>








23.25.LPAD
23.25.1.LPAD(str,len,padstr): Left-paded str with the string padstr to a length of len characters
23.25.2.Padding * to the first name