How does sugar preserve food?

This question was asked by Mary from East Sussex, UK.  Humans have used sugar to preserve food for thousands of…