A country and a timeframe would be helpful in responding to your query.
For example, in the 1901 census for England, you can find the following:
Subseries within RG 13 - Royal navy ships
Subsubseries within RG 13 - Registration District: ROYAL NAVY AT SEA AND IN PORTS ABROAD
In 1911, the breakdown is slightly different, with the Registration Districts listed as: Australia & South Africa, China, China & East Indies, Hampshire, Mediterranean, Misc. Locations.