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
- Weekly Trends
- Java Basic Programming Exercises
- SQL Subqueries
- Adventureworks Database Exercises
- C# Sharp Basic Exercises
- SQL COUNT() with distinct
- JavaScript String Exercises
- JavaScript HTML Form Validation
- Java Collection Exercises
- SQL COUNT() function
- SQL Inner Join
- JavaScript functions Exercises
- Python Tutorial
- Python Array Exercises
- SQL Cross Join
- C# Sharp Array Exercises