Just as a very simple example, let\'s say I have table test with sample data like so:
test
a | b ------------- 1 | 18 1 |
Personally, I would use
select a, count(b) from test where b < 50 group by a
Clear, concise and according to this SQL fiddle a tiny bit quicker than the others (needs less data according to the execution plan, though with a table that small you won't notice a difference):