Tuesday, November 8
Hey, get going on this Election Predictions in SQL assignment, which has to be done by 5 because of that election thing. Sorry for the late notice!
- Download this SQLite database: election2016.sqlite
- Look at it in spreadsheet form, especially the queries page.
- Do the assignment, as overly verbosely as it is written. Basically, I want you to end up with a spreadsheet like this: Dan's predictions
Winner gets a prize. Usually it's been me.
I'll show up to class at around 1:50PM. Please complete at least these steps, and then practice the long list of queries I provided) as they are relevant to the midterm.
If you can solve the queries rated 4, you're good to go.
Make sure you can complete these steps for the homework:
- Download this database: election2016.sqlite
- Open it.
- Look at the
SELECT * from predictions
- You have to fill that table yourself, so delete everything in it:
DELETE FROM predictions
- Insert a row that represents what you think the national race will turn out:
INSERT INTO predictions(sunetid, state, Trump, Clinton) VALUES('leland', 'Nationwide', 40.5, 56.7)
Now think about how to do that for every row for the 51 states.
- How do we select a list of state names and popular vote for Obama and Romney in the 2012 race (check the
- How do we get a list of the top 10 state names with the highest Hispanic population? (check
- How do we get the average polling for the Republican and Democratic presidential candidates for Ohio, using only polls from 300 days into the race?