"The Master and His Pupil" is an English fairy tale collected by Joseph Jacobs in his English Fairy Tales.[1]
A learned man had a book in which he had the knowledge to control demons. His foolish pupil one day found it open and read a spell from it. Beelzebub (a demon) appeared and demanded a task from him, or he would strangle him. The pupil set him to watering a flower, but Beezlebub went on watering it until the room was filling with water. At that point, the man, having remembered he left his book unlocked, returned and dispelled Beezlebub.