Curriculum
Course: SQL
Login

Curriculum

SQL

SQL References

0/80

MySQL Functions

0/139

SQL Server Functions

0/84

SQL Quick Ref

0/1
Text lesson

REPEAT

Example

Repeat the string three times:

SELECT REPEAT(“SQL Tutorial”, 3); 

Definition and Usage

The REPEAT() function replicates a string as many times as specified.

Syntax

REPEAT(string, number)

Parameter Values

Parameter

Description

string

Input required: The string that will be repeated.

number

Input required: The number of times the string will be repeated.

Technical Details

Works in: From MySQL 4.0

More Examples

Example

Duplicate the text in the CustomerName column twice.

SELECT REPEAT(CustomerName, 2)
FROM Customers; 

Example

Duplicate the string zero times.

SELECT REPEAT(“SQL Tutorial”, 0);