Sunswan - quite true as you stated - but - for safety
and convenience is is common to have at least two batteries onboard the boat.
One dedicated to the "ship's services/house" like lights, radios, instruments and other electrical equipment
The other battery dedicated to starting the engine
. AND - they are separated by a battery switch or switches that keeps then separate from one another until you decide to do otherwise.
For the easiest and most convenient recharging of the batteries the use of a battery isolator (diode bar) or Battery Combiner (voltage sensing relay) allows the alternator
or shore power
or some other source like wind generator
to keep the batteries from being electrically connected to each other. So if one battery goes bad or is mistakenly discharged too much, you have the other battery available to start the engine
and get you and your boat home.
The exact equipment
and choice of such systems is extremely varied and you will find pages and pages of recommendations of which one or more to use. But the bottom line is "keep them separate" and keep one of them available to the engine so you can get home.