This invention relates to a compound of formula (I) or a pharmaceutically acceptable salt thereof with 5-HT4 agonistic activities, which is useful in the treatment of dementia. This invention also relates to a pharmaceutical composition for the treatment of dementia which comprises a therapeutically effective amount of a compound of formula (I) or a pharmaceutically acceptable salt thereof. Further this invention relates to a method for the treatment of dementia in an animal subject including a mammalian subject, which comprises administering to the animal subject including a mammalian subject a compound of the formula (I) or a pharmaceutically acceptable salt thereof.