CodesJava

Easy learning with example program codes

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 supports 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', 10123);

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:
error









Copyright © 2019 CodesJava DMCA.com Protection Status