This MariaDB tutorial explains how to use the MariaDB RPAD function with syntax and examples.
The MariaDB RPAD function returns a string that is right-padded with a specified string to a certain length.
The syntax for the RPAD function in MariaDB is:
RPAD( string, length, pad_string )
The string to right-pad.
The length of the result after string has been right-padded.
The specified string to right-pad to string.
The RPAD function can be used in the following versions of MariaDB:
Let's look at some MariaDB RPAD function examples and explore how to use the RPAD function in MariaDB.
For example:
SELECT RPAD('AODBA.com', 20, 'A');
Output: 'AODBA.comAAAA'
SELECT RPAD('AODBA.com', 20, 'ABC');
Output: 'AODBA.comABCA'
SELECT RPAD('AODBA.com', 21, 'ABC');
Output: 'AODBA.comABCAB'
SELECT RPAD('AODBA.com', 4, 'ABC');
Output: 'Tech'
SELECT RPAD('dbd', 8, ' ');
Output: 'dbd '
SELECT RPAD('dbd', 6, '123');
Output: 'dbd12'
SELECT RPAD('dbd', 7, '123');
Output: 'dbd123'