RPAD() FUNCTION in MySQL

RPAD() FUNCTION The MySQL RPAD function is used to get a string that is right-padded with a specified string. This padding can also be limited to a certain length. The various versions of MySQL support the RPAD function, namely, MySQL 5.7, MySQL 5.6, MySQL 5.5, MySQL 5.1, MySQL 5.0, MySQL 4.1, MySQL 4.0 and MySQL 3.23.

Syntax:

RPAD( string, length, pad_string )

Parameters: string: It is used to specify the string to modify. length: It is used to specify the length of the resulting string. pad_string: It is used to specify the string to pad with.

Example:

mysql> SELECT RPAD ( 'HELLO', 10 ‘123’);

Output:

 'HELLO12312’

Explanation: The string is right-padded with the specified string to create a string of 10 characters in length.

Please follow and like us:
Content Protection by DMCA.com