- Given the table Employee (employee_id, name) and Salary (employee_id, salary) with some extra info that aren't crucial, give the list of employee_id that do not have names or salaries in ascending order.
- select inner_select.employee_id from (
- select employee_id from Employees where employee_id not in (select employee_id from Salaries)
- union
- select employee_id from Salaries where employee_id not in (select employee_id from Employees)
- ) as inner_select order by inner_select.employee_id asc;
- I think it could be improved to be more efficient. One idea is to join Employee and Salary on the employees that are in both and then take a subtraction between all the employee_id and those in the join. But that operation may cost quite a bit as well (a join is not cheap and the diff is not cheap too).
- Idee it seems that it is possible to improve quite a bit.
- "Runtime: 596 ms, faster than 43.59% of MySQL online submissions for Employees With Missing Information.
- Memory Usage: 0B, less than 100.00% of MySQL online submissions for Employees With Missing Information."