How many captains with younger than 50 are in each rank?
SELECT count(*) ,  rank FROM captain WHERE age  <  50 GROUP BY rank
SELECT count(*) ,  rank FROM captain WHERE age  <  50 GROUP BY rank
[{'count(*)': 1, 'Rank': 'Commander, junior captain'}, {'count(*)': 1, 'Rank': 'Lieutenant'}, {'count(*)': 3, 'Rank': 'Midshipman'}]