how many ships have a single captain?
Select count ( * )  from  ( SELECT * FROM ship AS t1 JOIN captain AS t2 ON t1.ship_id   =   t2.ship_id GROUP BY t2.ship_id HAVING count ( * )    =  1 ) 
ships with a single captain refers to COUNT(*) FROM ships JOIN captains ON ships.ship_id = captains.ship_id GROUP BY captains.ship_id HAVING COUNT(captains.captain_id) = 1;