Skip to content
Advertisement

Sql Performance join Vs co-related Subquery

TABLE : employee (id,mid,join_date)

Question – Find all employees who joined before their managers

Query 1:

Query 2:

Which of them is correct? If both correct, then how is the performance?

Advertisement

Answer

They are both correct.

Performance questions need to be tested on your data on your system. However, with a primary key on employee(id), I would expect both to have very similar performance.

You can check the execution plans to see if there is any difference.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement