REPEAT()

Description

Returns a string consisting of the string str repeated count times. If count is less than 1, returns an empty string. Returns NULL if str or count is NULL.

Syntax

1. > REPEAT(str,count)

Arguments

Arguments Description
str Required. The string to repeat.
count Required. The number of times to repeat.

Examples

1. mysql> SELECT repeat('abc', -1);
2. +-----------------+
3. | repeat(abc, -1) |
4. +-----------------+
5. |                 |
6. +-----------------+
7. 1 row in set (0.00 sec)

9. mysql> SELECT repeat('abc', 1), repeat('abc', 2), repeat('abc', 3);
10. +----------------+----------------+----------------+
11. | repeat(abc, 1) | repeat(abc, 2) | repeat(abc, 3) |
12. +----------------+----------------+----------------+
13. | abc            | abcabc         | abcabcabc      |
14. +----------------+----------------+----------------+
15. 1 row in set (0.00 sec)