REPEAT() 함수의 출력을 더 읽기 쉽게 만들고 싶다면 다른 함수를 함께 사용할 수 있습니다. 예를 들어, 반복되는 값 사이에 공백이나 다른 문자를 추가하려면 CONCAT() 함수를 사용할 수 있습니다.
예시
mysql> Select REPEAT(CONCAT(' *',Subject,'* '),3)AS Subject_repetition from student;
+-----------------------------------------+
| Subject_repetition |
+-----------------------------------------+
| *Computers* *Computers* *Computers* |
| *History* *History* *History* |
| *Commerce* *Commerce* *Commerce* |
| *Computers* *Computers* *Computers* |
| *Math* *Math* *Math* |
+-----------------------------------------+
5 rows in set (0.00 sec) 아래 예에서는 QUOTE() 및 CONCAT() 함수를 REPEAT() 함수와 함께 사용하고 있습니다.
mysql> Select REPEAT(QUOTE(CONCAT(' *',Subject,'* ')),3)AS Subject_repetition from student;
+-----------------------------------------------+
| Subject_repetition |
+-----------------------------------------------+
| ' *Computers* '' *Computers* '' *Computers* ' |
| ' *History* '' *History* '' *History* ' |
| ' *Commerce* '' *Commerce* '' *Commerce* ' |
| ' *Computers* '' *Computers* '' *Computers* ' |
| ' *Math* '' *Math* '' *Math* ' |
+-----------------------------------------------+
5 rows in set (0.00 sec) 이런 식으로 REPEAT() 함수와 함께 다른 함수를 사용하여 출력을 더 읽기 쉽게 만들 수 있습니다.