RPAD() function pad string at right side in MySQL.
RPAD() function syntax:
RPAD(string.length,padstring)
the first argument is the string that gets padded
the second argument is the number of the length which RPAD() will return
the third argument is the string which gets padded after the string. this argument should be string or charcater
Example :
select RPAD("PAD",4,"DD");//retrun PADD
select RPAD("i love ",10,"u");//retrun i love uuu
if the second argument length is the less than the length of the main string it cut down the string instead of padding at right
select RPAD("i love",3,'u') //i l
so as you can see above query, RPAD("i love",3,'u') return three-character, because the second argument is 3, and thats why it returns 3 characters.