NCVotes / ncvoter

Moved from reesenewslab github. now just home for issues without a home. All the action's at https://github.com/NCVotes/ncvoter/issues
0 stars 0 forks source link

Query that finds turnout by demographics #26

Closed rtburg closed 7 years ago

rtburg commented 7 years ago

With the data that exists in our current production database, can we write a query that gives us the turnout rate (voters who voted/all registered voters with status A or I) of white voters in Robeson county in the November 2016?

Can we query it in a way that shows us the turnout rate for white voters in Robeson County in November 2012? (Challenging because we need to know who was registered in November 2012. Can't just assume currently registered voters were valid voters in Robeson in 2012).

Can we also say, which voters voted in 2008 & 2012 BUT NOT 2016 in Robeson County?

bill10 commented 7 years ago

Yes, I think we can get a good estimate of it.

select ncid from voter_ncvoter
where county_desc='ROBESON' and 
 registr_dt>='11/01/2016' and 
 registr_dt<='11/30/2016' and 
 race_code='W' and 
 voter_status_desc!='REMOVED';

give all the white registered voters in Robeson in November 2016, which is the denominator.

select ncid from voter_ncvhis
where county_desc='ROBESON' and 
 election_lbl>='11/01/2016' and 
 election_lbl<='11/30/2016';

give those who vote in Robeson in November 2016. To get white voters, it needs to be joined with all white registered voters.

select * from
(select ncid from voter_ncvoter
where county_desc='ROBESON' and 
 registr_dt>='11/01/2016' and 
 registr_dt<='11/30/2016' and 
 race_code='W' and 
 voter_status_desc!='REMOVED') t1
join
(select ncid from voter_ncvhis
where county_desc='ROBESON' and 
 election_lbl>='11/01/2016' and 
 election_lbl<='11/30/2016') t2
on t1.ncid=t2.ncid;

give the numerator.

rtburg commented 7 years ago

This issue was moved to NCVotes/analytics#12