Best Practices to tune up T-SQL and SP





0/5 (0 vote)
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.nameFROM teacher INNER JOIN student ...
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