SELECT
(TS_LEXIZE('english_stem',
UNNEST(STRING_TO_ARRAY(
REGEXP_REPLACE(feedback, '[^a-zA-Z]+', ' ', 'g'),
' ')
)))[1] AS token,
AVG(rating) AS avg_rating
FROM customer_survey
GROUP BY 1
HAVING COUNT(1) >= 3
ORDER BY 2 DESC
;
I have the following query where would you add ROUND () if you want to limit the rating to 2 decimal places?
SELECT
(TS_LEXIZE('english_stem',
UNNEST(STRING_TO_ARRAY(
REGEXP_REPLACE(feedback, '[^a-zA-Z]+', ' ', 'g'),
' ')
)))[1] AS token,
ROUND(AVG(rating)) AS avg_rating
FROM customer_survey
GROUP BY 1
HAVING COUNT(1) >= 3
ORDER BY 2 DESC
;
By adding the round before the avg I got it.