Leetcode Note: MySQL - Employees With Missing Information

Employees With Missing Information - LeetCode
https://leetcode.com/problems/employees-with-missing-information/

  • MySQL で取り組んだメモ

回答

Implementing FULL JOIN in MySQL - Employees With Missing Information - LeetCode
https://leetcode.com/problems/employees-with-missing-information/solutions/1946042/implementing-full-join-in-mysql/

SELECT T.employee_id
FROM  
  (SELECT * FROM Employees LEFT JOIN Salaries USING(employee_id)
   UNION 
   SELECT * FROM Employees RIGHT JOIN Salaries USING(employee_id))
AS T
WHERE T.salary IS NULL OR T.name IS NULL
ORDER BY employee_id;