Which function is used to repeat a string in SQL?

REPEAT() function in MySQL is used to repeat a string a specified number of times.

Syntax :

REPEAT(str, count)

Parameters :

This method accepts two parameters.

  • str –Input String which we want to repeat.
  • count –It will describe how many times to repeat the string.

Returns : It returns a repeated string.

Example: Repeating the String ‘Geeks’ 3 times with the help of REPEAT Function.

SELECT REPEAT("Hello", 3) 
AS Repeated_String;

Output :

REPEATED_STRING

HelloHelloHello