- Count the votes for Sen. Olympia Snowe, whose id is 524.
sqlite> SELECT COUNT(id) FROM votes WHERE politician_id = 524;
23
- Now do that query with a JOIN statement without hard-coding the id 524 explicitly, querying both the votes and congress_members table.
sqlite> SELECT COUNT(votes.id) FROM votes JOIN congress_members
...> ON votes.politician_id = congress_members.id
...> WHERE congress_members.name = 'Sen. Olympia Snowe';