Replicate String for a Specified Number of Times in MySQL



With the help of MySQL REPEAT() function, we can replicate a string for a specified number of times.

Syntax

REPEAT(Str, No.)

Here 

  • Str is the string which is to be replicated for a specified number of times.
  • No. is the numerical value which indicates that how many times the string would be repeated.

Example

mysql> Select REPEAT('#*',5);
+----------------+
| REPEAT('#*',5) |
+----------------+
| #*#*#*#*#*     |
+----------------+
1 row in set (0.00 sec)
Updated on: 2020-02-10T05:37:30+05:30

177 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements