CodesJava

Easy learning with example program codes

REPEAT() FUNCTION in MySQL

REPEAT() FUNCTION
The MySQL REPEAT function is used to repeat a string a specified number of times. The various versions of MySQL supports the REPEAT function, namely, MySQL 5.7, MySQL 5.6, MySQL 5.5, MySQL 5.1, MySQL 5.0, MySQL 4.1, MySQL 4.0 and MySQL 3.23.

Syntax:

REPEAT( string, number )

Parameters:
string: It is used to specify the string to repeat.
number: It is used to specify the number of times to repeat.

Example 1:

mysql> SELECT REPEAT ( ‘XYZ’, 4  );

Output:

‘XYZXYZXYZXYZ’

Explanation:
The specified string is repeated 4 times.

Example 2:

mysql> SELECT REPEAT ( 2, 5 );

Output:

22222

Explanation:
The specified expression is repeated 5 times.

Please follow and like us:
error









Copyright © 2019 CodesJava DMCA.com Protection Status