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

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 408
    Comment on it

    REPEAT(str,count)

    If you want to repeat a string str at given times then you can use the REPEAT mysql function. REPEAT function returns a string consisting of the string str repeated count times. It returns an empty string if count is less than 1 and returns NULL if str or count are NULL.

    Here are some example which will explain you this function-

    mysql> SELECT REPEAT('MySQL',5);
    +---------------------------+
    | REPEAT('MySQL',5)         |
    +---------------------------+
    | MySQLMySQLMySQLMySQLMySQL |
    +---------------------------+
    1 row in set (0.00 sec)
    
    mysql> SELECT REPEAT('MySQL ',5);
    +--------------------------------+
    | REPEAT('MySQL ',5)             |
    +--------------------------------+
    | MySQL MySQL MySQL MySQL MySQL  |
    +--------------------------------+
    1 row in set (0.00 sec)
    
    mysql> SELECT REPEAT('MySQL ',0);
    +--------------------+
    | REPEAT('MySQL ',0) |
    +--------------------+
    |                    |
    +--------------------+
    1 row in set (0.00 sec)
    
    mysql> SELECT REPEAT('MySQL ',1);
    +--------------------+
    | REPEAT('MySQL ',1) |
    +--------------------+
    | MySQL              |
    +--------------------+
    1 row in set (0.00 sec)
    
    mysql> SELECT REPEAT('MySQL ',NULL);
    +-----------------------+
    | REPEAT('MySQL ',NULL) |
    +-----------------------+
    | NULL                  |
    +-----------------------+
    1 row in set (0.00 sec)
    
    mysql> SELECT REPEAT(NULL,2);
    +----------------+
    | REPEAT(NULL,2) |
    +----------------+
    | NULL           |
    +----------------+
    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: