SQL PHP HTML ASP JavaScript articles and free scripts to download
 

RPAD mysql string function

MySQL RPAD string function is used to pad strings from right. We will use this function along with select query but it can be used along with any other string commands.

Here are some examples of RPAD function

select rpad('plus2net',15,'*')

The output is here plus2net*******

We have added another string to right of our input string and the final output is of length 15 char. One more example is here

SELECT rpad( 'plus2net', 15, 'abc' )

Output of this is plus2netabcabca

What happens if we give less than the input string length.

SELECT rpad( 'plus2net', 5, 'abc' )

Output will be plus2 ( Upto 5 char only )


Post Comment This is for short comments only. Use the forum for more discussions.
Name
Email( not to be displayed)Privacy Policy
1+2=This is to prevent automatic submission by spammers. Please enter the result of the sum as asked


Join Our Email List
Email:  
For Email Newsletters you can trust
SQL Tutorial List
MySQL String
SQL Commands
SQL Sections
Date & Time
Join Table
String
Math