People who spend more time in school or university are likely to live longer than those with no formal education.