keshanValidator Voting vs. Investor Inclinations
    Updated 2022-04-27
    with last_props as (
    select distinct proposal_id from terra.gov_vote where tx_status = 'SUCCEEDED' order by to_number(proposal_id) desc limit 5
    ),
    votes as (select voter, voter_label_subtype, voter_address_label, voter_address_name, proposal_id, option, voting_power
    from terra.gov_vote
    where tx_status = 'SUCCEEDED' and proposal_id in (select proposal_id from last_props))

    select count(distinct voter) as num_votes, proposal_id, option, sum(case when voter_label_subtype is null then 0 else 1 end) as num_validators,
    sum(voting_power) as total_voting_power, sum(case when voter_label_subtype is null then 0 else voting_power end) as validator_voting_power,
    validator_voting_power * 100 / total_voting_power as percentage,
    100 - (validator_voting_power * 100 / total_voting_power) as retail_percentage
    from votes
    group by proposal_id, option
    Run a query to Download Data