MySQLString FunctionsREPEAT
RPAD

REPEATString Functions

REVERSE

Repeats a string n times.

Syntax

REPEAT(str, n)

Example

Enter values below to update the example in real time.

product_name
rating
stars
reviews
-- 별점(1~5)을 막대로 시각화
SELECT product_name, CONCAT('[', REPEAT('★', rating), REPEAT('☆', 5 - rating), ']') AS stars
FROM reviews;