REPEAT()¶
Function Description¶
REPEAT() is used to repeat the input string str in counttimes and return a new string. Ifcountis less than 1, an empty string is returned. IfstrorcountisNULL,NULL` is returned.
Function Syntax¶
Text
> REPEAT(str,count)
Parameter definition¶
Parameters |
Description |
|---|---|
str |
Required parameters. The string to be repeated. |
count |
Required parameters. Number of times to be repeated |
Example¶
Text
mysql> SELECT repeat('abc', -1);
+-----------------+
| repeat(abc, -1) |
+-----------------+
| |
+-----------------+
1 row in set (0.00 sec)
mysql> SELECT repeat('abc', 1), repeat('abc', 2), repeat('abc', 3);
+----------------+----------------+----------------+
| repeat(abc, 1) | repeat(abc, 2) | repeat(abc, 3) |
+----------------+----------------+----------------+
| abc | abcabc | abcabcabc |
+----------------+----------------+----------------+
1 row in set (0.00 sec)
Last updated on