Assignments for October 22

Reading/Discussion:
Data Planet from TwinCities.com. Play around with it, explore.
The Three Laws of Open Government Data.
Let’s Compare Votes

SQLite: Using the senate_votes database that we downloaded and looked at in class, write SQL to answer the following questions:

  • How many votes had 0 no votes?
  • A: SELECT * FROM votes where total_no = 0

  • How many votes had a margin of less than 3 votes?
  • A: SELECT * FROM votes WHERE total_margin < 3

  • How many times did each result occur?
  • A: SELECT result, COUNT(*) FROM votes GROUP BY 1

  • How many nomination votes got more than 30 Republican “no” votes?
  • A: SELECT * FROM votes WHERE question=’On the Nomination’ and gop_no > 30

  • What was the result of all cloture votes, and how many times did each result occur?
  • A: SELECT result, COUNT(*) FROM votes WHERE question like ‘%Cloture%’ GROUP BY 1

Then, import this CSV file from the National Science Foundation into a new sqlite database. Email me the database you created and the SQL statements for the senate votes data.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s