These two queries are not synonymous.
They would be synonymous if you replaced INNER JOIN with a LEFT JOIN , except that the subquery is subject to rejection if the deptid not unique and the LEFT JOIN will always succeed.
If depts.deptid has a UNIQUE index (which probably is, since this field is most likely PRIMARY KEY ), then the performance difference will be negligible.
source share