Autumn Offers - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Concatenation
Simple text functions
Modifying strings
19. The REPEAT() function
Summary

Instruction

Fantastic! The last function in this section is REPEAT(). It repeats a string (given in the first parameter) however many times specified by the second parameter. Here's an example:

SELECT REPEAT('.', 3) || name
FROM item;

This query returns the item name with three periods in front of it. Let's try this function out!

Exercise

Slogans with multiple star and dot characters (e.g., SLOGAN *.*.*.*.*.) are fashionable this season. The marketing agency management has decided to change all slogans' texts to add at the end a space and a chain of five '.**.'. Name the column fashionable_text.

Stuck? Here's a hint!

You will need the following expression:

text || ' ' || REPEAT('.**.',5)