Postgres - 当流派列有逗号分隔值时获取每个流派的计数 'Action, Comedy,....Thriller...'

Postgres - Get the count of each genre when the genre column has comma seperated values 'Action, Comedy,....Thriller...'

我有以下 table,第四列包含每部电影的类型。我想要实现的是找到每个流派的计数。

"C6523" 1894    "f" "Documentary,Short"
"C4532" 1892    "f" "Animation,Short"
"P1616" 1892    "f" "Animation,Comedy,Romance"
"B512"  1892    "f" "Animation,Short"
"B4253" 1893    "f" "Comedy,Short"
"C5215" 1894    "f" "Short"
"C6135" 1894    "f" "Short,Sport"
"E3252" 1894    "f" "Documentary,Short"

预期输出:

Animation : 12300..
Comedy: 5000...

尝试使用 Sub Query

SELECT "MovieGenres", COUNT("MovieGenres")
FROM (
       SELECT UNNEST(string_to_array(subject, ',')) as "MovieGenres" FROM Table
     ) X