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); Result: 'TT' SELECT REPEAT('t', 5); Result: 'ttttt' SELECT REPEAT('totn', 2); Result: 'totntotn' SELECT REPEAT(' ', 6); Result: ' ' SELECT REPEAT(123, 2); Result: '123123' SELECT REPEAT('abc', 0); Result: ''
Advertisements