RPAD(str,len,padstr)
RPAD mysql function returns the string str, right-padded with the string padstr to a length of len characters means if you want to get a string to a given length and if the length of string is sorter than add the given character in to string at the place of the remain length. RPAD the return value is shortened to len characters If str is longer than len.
mysql> SELECT RPAD('Hello MySQL',15,'*');
+----------------------------+
| RPAD('Hello MySQL',15,'*') |
+----------------------------+
| Hello MySQL**** |
+----------------------------+
1 row in set (0.00 sec)
mysql> SELECT RPAD('Hello MySQL',5,'*');
+---------------------------+
| RPAD('Hello MySQL',5,'*') |
+---------------------------+
| Hello |
+---------------------------+
1 row in set (0.00 sec)
mysql> SELECT RPAD('Hello MySQL',10,'*');
+----------------------------+
| RPAD('Hello MySQL',10,'*') |
+----------------------------+
| Hello MySQ |
+----------------------------+
1 row in set (0.00 sec)
0 Comment(s)