Group by ships by flag, and return number of ships that have each flag.
select count(*), flag from ship group by flag