当前位置: 代码迷 >> 综合 >> Leetcode Mysql 1789. 员工的直属部门(DAY 12)
  详细解决方案

Leetcode Mysql 1789. 员工的直属部门(DAY 12)

热度:78   发布时间:2023-11-17 16:58:22.0

文章目录

    • 原题题目
    • 代码实现(首刷自解)


原题题目


在这里插入图片描述


代码实现(首刷自解)


# Write your MySQL query statement below
SELECT employee_id,department_id
FROM employee AS e
GROUP BY employee_id
HAVING COUNT(*) = 1UNION
SELECT employee_id,department_id
FROM employee AS e
WHERE primary_flag = 'Y'
  相关解决方案