Created
September 15, 2016 20:14
-
-
Save michael-erasmus/d516db0b293201cc37ebd06cf175b3b0 to your computer and use it in GitHub Desktop.
Buffer emoji updates count
This file contains hidden or 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
DROP TABLE "public"."emoji_table"; | |
CREATE TABLE "public"."emoji_table" | |
( | |
"emoji" VARCHAR(70) | |
,"meaning" VARCHAR(160) | |
) | |
DISTSTYLE ALL; | |
--got this file from http://stats.seandolinar.com/wp-content/uploads/2015/04/emoji_table.txt | |
copy emoji_table from 's3://buffer-data/emoji_table.txt' | |
credentials 'aws_access_key_id=xxx;aws_secret_access_key=xxx' | |
delimiter ','; | |
select * from emoji_table | |
limit 10; | |
--Top 50 emojis | |
select | |
emoji, | |
to_char(count(distinct id), '999,999,999,990D') | |
from updates,emoji_table | |
where sent_at > dateadd(day, -30, current_date) | |
and text like '%' || emoji_table.emoji || '%' | |
group by 1 | |
order by 2 desc | |
limit 50; | |
--Emoji updates and total | |
select | |
count(distinct id) | |
from updates,emoji_table | |
where sent_at > dateadd(day, -30, current_date) | |
and text like '%' || emoji_table.emoji || '%' | |
limit 50; | |
--417609 | |
select | |
count(distinct id) total | |
from updates | |
where sent_at > dateadd(day, -30, current_date); | |
-- 5616244 | |
select 417609.0 / 5616244; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment