MySQL REPEAT() function
REPEAT() function
MySQL REPEAT() repeats a string for a specified number of times. Both the string and the number of times that string to be repeated are supplied as arguments.
The function returns NULL either any of the arguments is NULL.
Syntax:
REPEAT(str, count)
Arguments:
Name | Description |
---|---|
str | A string which is to be repeated. |
count | An integer indicating how many times the string str is to be repeated. |
Syntax Diagram:
MySQL Version: 5.6
Video Presentation:
Example: MySQL REPEAT() function
The following MySQL statement repeats the string ‘**-‘ 15 times.
Code:
SELECT REPEAT('**-',15);
Sample Output:
mysql> SELECT REPEAT('**-',15); +-----------------------------------------------+ | REPEAT('**-',15) | +-----------------------------------------------+ | **-**-**-**-**-**-**-**-**-**-**-**-**-**-**- | +-----------------------------------------------+ 1 row in set (0.03 sec)
All String Functions
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practice, Solution
- Java Regular Expression: Exercises, Practice, Solution
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework