我尝试应用查询来搜索表格的一列(文本),并返回其中最常见的二元组。
我遇到了这个问题,但我正在努力操纵它以适应我的数据集:
SELECT word, nextword, COUNT(*) c
FROM (
SELECT pos, title, word, LEAD(word) OVER(PARTITION BY created_utc,title ORDER BY pos) nextword FROM (
SELECT created_utc, title, word, pos FROM FLATTEN(
(SELECT created_utc, title, word, POSITION(word) pos FROM
(SELECT created_utc, title, SPLIT(title, ' ') word FROM [bigquery-samples:reddit.full])
), word)
))
WHERE nextword IS NOT null
GROUP EACH BY 1, 2
ORDER BY c DESC
LIMIT 100
(该查询是为Reddit评论转储而编写的)
如何更改此查询以查看我的文字'列,没有别的?
我有点关注什么' pos'和' title'请参阅 - 请耐心等待,我是SQL的新手! :)
非常感谢提前。