SteemSQL Tutorial – What are the Outgoing Votes for Big Whales?


whale SteemSQL Tutorial - What are the Outgoing Votes for Big Whales? mssql sql SteemIt

steemit whales

In @nationalpark ‘s post, a few whale’s outgoing votes have been analysed. As we know, all the voting data have been recorded in Steem SQL’s TxVotes where it has the following structure:

table-txvotes-steemsql SteemSQL Tutorial - What are the Outgoing Votes for Big Whales? mssql sql SteemIt

table-txvotes-steemsql

The input is the Big whale’s ID voter and we can group the results by author, count and sum the weights up, like this:

1
2
3
4
5
6
7
8
9
select 
    author, count(1) "Count", sum(weight) "Total Weights", sum(weight)/count(1) "Average Weight"
from
    TxVotes
where
    voter = 'abit'
group by
    author
order by sum(weight) desc
select 
    author, count(1) "Count", sum(weight) "Total Weights", sum(weight)/count(1) "Average Weight"
from
    TxVotes
where
    voter = 'abit'
group by
    author
order by sum(weight) desc

The SQL will look for all historic votes made by @abit and here are the first 1000 items.

linqpad-steemsql SteemSQL Tutorial - What are the Outgoing Votes for Big Whales? mssql sql SteemIt

linqpad-steemsql

We can also add the timestamp restraints (in the where statement) for example, for the last 7 days.

1
and datediff(day, timestamp, GetUTCDate()) between 0 and 7
and datediff(day, timestamp, GetUTCDate()) between 0 and 7

We can also add select top 10 if you are only interested in the first 10 authors.

We can also sort the results by total number of votes order by count(1) instead of total voting weight.

We can also add having count(1) >= 5 to show the authors that gain at least 5 votes.

You may also like: STEEMSQL 系列之大鱼们都给谁投票了?

STEEM SQL Tutorial

–EOF (The Ultimate Computing & Technology Blog) —

GD Star Rating
loading...
639 words
Last Post: How am I doing with SteemIt Curation Bot?
Next Post: SteemIt: Javascript Function to Get Original Post from Comment's PermLink

The Permanent URL is: SteemSQL Tutorial – What are the Outgoing Votes for Big Whales?

Leave a Reply