Created
February 22, 2017 09:51
-
-
Save savelee/63845c95e8d9e1012a6dca733588e983 to your computer and use it in GitHub Desktop.
BigQuery Window Function example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#standardSQL | |
SELECT | |
corpus, | |
word, | |
word_count, | |
RANK() OVER (PARTITION BY corpus ORDER BY word_count DESC) rank | |
FROM | |
`publicdata.samples.shakespeare` | |
WHERE | |
LENGTH(word) > 10 | |
AND word_count > 10 | |
ORDER BY word_count DESC | |
LIMIT | |
40 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment