我有下表,第四列包含每部电影的流派。我要实现的是找到每种流派的数量。
"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...
答案 0 :(得分:0)
尝试使用Sub Query
SELECT "MovieGenres", COUNT("MovieGenres")
FROM (
SELECT UNNEST(string_to_array(subject, ',')) as "MovieGenres" FROM Table
) X