Mariadb Repeat Function

MariaDB: REPEAT Function

This MariaDB tutorial explains how to use the MariaDB REPEAT function with syntax and examples.

Description

The MariaDB REPEAT function repeats a string a specified number of times.

Syntax

The syntax for the REPEAT function in MariaDB is:

REPEAT( string, number )

Parameters or Arguments

string

The string to repeat.

number

The number of times to repeat the string.

Note

  • If number is less than 1, the REPEAT function will return an empty string.

Applies To

The REPEAT function can be used in the following versions of MariaDB:

  • MariaDB 10

Example

Let's look at some MariaDB REPEAT function examples and explore how to use the REPEAT function in MariaDB.

For example:

SELECT REPEAT('T', 2);
Output: 'TT'

SELECT REPEAT('t', 5);
Output: 'ttttt'

SELECT REPEAT('dbd', 2);
Output: 'dbddbd'

SELECT REPEAT(' ', 6);
Output: '      '

SELECT REPEAT(123, 2);
Output: '123123'

SELECT REPEAT('abc', 0);
Output: ''