MySQLNumeric FunctionsROUND
FLOOR

ROUNDNumeric Functions

TRUNCATE

Rounds x to d decimal places.

Syntax

ROUND(x, d)

Example

Enter values below to update the example in real time.

product_id
rating
avg_rating
reviews
-- 평균 평점 소수 첫째 자리
SELECT product_id, ROUND(AVG(rating), 1) AS avg_rating
FROM reviews
GROUP BY product_id;