I can't imagine that a correlated subquery is your best answer here:
SELECT name FROM teacher WHERE EXISTS (SELECT 1 FROM student WHERE teacher.teacher_id = student.teacher_id)
Instead, how about an INNER JOIN?
SELECT DISTINCT teacher.name
FROM teacher
INNER JOIN student
ON teacher.teacher_id = student.teacher_id