Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.

### Instruction:

Convert text to sql: How many captains are in each rank? | captain : captain_id , name , ship_id , age , class , rank | ship : ship_id , name , type , built_year , class , flag | captain.ship_id = ship.ship_id | 

### Response:

select count ( _ ) , _ from _ group by _ | select count ( * ) , rank from captain group by rank