- Count the votes for Sen. Olympia Snowe, whose id is 524.
votes
-------
23
- Now do that query with a
JOIN
statement without hard-coding the id 524
explicitly, querying both the votes and congress_members table.
votes
-------
23
- How about Rep. Erik Paulsen? How many votes did he get?
votes
-------
21
- Make a list of Congress members that got the most votes, in descending order. Exclude the create_at and updated_at columns.
name votes
-------- --------
Rep. Dan Benishek 32
Rep. Tammy Baldwin 31
Rep. Dale Kildee 31
Rep. Jim Costa 31
Rep. Frank Pallone 31
Sen. Maria Cantwell 30
Rep. Ruben Hinojosa 29
Rep. Marcia Fudge 29
Rep. Devin Nunes 28
Sen. Ron Johnson 28
Rep. Scott DesJarlais 28
Rep. Zoe Lofgren 28
.
.
.
- Now make a list of all the Congress members that got the least number of votes, in ascending order. Again, skip the date columns.
name votes
-------- --------
Rep. Mike Rogers 6
Rep. Jim Sensenbrenner 7
Rep. Bill Cassidy 7
Rep. Tim Huelskamp 8
Rep. Ileana Ros-Lehtinen 8
Rep. Alan Nunnelee 9
.
.
.