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>