The REPEAT() function in MySQL is used to repeat a given string a specified number of times. It takes two arguments:
- The string that you want to repeat.
- The number of times you want to repeat it.
Syntax:
REPEAT(string, count)
string: The string you want to repeat.count: The number of times to repeat the string.
Example:
SELECT REPEAT('abc', 3);
This will return:
abcabcabc
In this example, the string 'abc' is repeated 3 times.
Notes:
- If
countis less than or equal to 0, the function will return an empty string. - If
stringis an empty string, the result will also be an empty string, regardless of the value ofcount.
No comments:
Post a Comment