Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • LPAD(str,len,padstr) function mysql

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 515
    Comment on it

    LPAD(str,len,padstr)

    LPAD mysql funtion returns the string str, left-padded with the string padstr to a length of len characters means if you want to extend a string to a certain length and insert some character in left side of string at the place of sorten length then you can use LPAD function. The return value is shortened to len characters, If str is longer than len.

    I am explaing this by some examples-

    mysql> SELECT LPAD('Hello MySQL',15,'*');
    +----------------------------+
    | LPAD('Hello MySQL',15,'*') |
    +----------------------------+
    | ****Hello MySQL            |
    +----------------------------+
    1 row in set (0.00 sec)
    
    mysql> SELECT LPAD('Hello MySQL',9,'*');
    +---------------------------+
    | LPAD('Hello MySQL',9,'*') |
    +---------------------------+
    | Hello MyS                 |
    +---------------------------+
    1 row in set (0.00 sec)
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: