我本地markdown的東西直接復制出來了。
多說一嘴,今天早上六點醒了,然后被外面吵,心里也擔心找實習就一直睡不著了。索性直接來實驗室,這一上午感覺好快啊。幸運的是,自己也沒有浪費時間,還行吧。SQL欠的賬遲早要還
181-employees-earning-more-than-their-managers
找出收入比經理高的員工
select a.name as 'Employee'
from employee as a, employee as b
where a.managerId = b.id and a.salary > b.salary
182-duplicate-emails
編寫解決方案來報告所有重復的電子郵件。 請注意,可以保證電子郵件字段不為 NULL。
以 任意順序 返回結果表。
查找重復的電子郵箱
select email
from Person
group by email
having count(email) > 1
183-customers-who-never-order
https://leetcode.com/problems/customers-who-never-order/description/
找出所有從不點任何東西的顧客。
從不訂購的客戶,2025年6月9日 星期一
select customers.name as 'Customers'
from customers
where Customers.id not in (select customerId from orders)-- left join
select customers.name as 'Customers'
from customers
left join orders on Customers.id = Orders.customerId
where Orders.customerId is null
184-department-highest-salary
查找出每個部門中薪資最高的員工。
按 任意順序 返回結果表。
https://leetcode.com/problems/department-highest-salary/description/
部門工資最高的員工
select Department.name as 'Department',Employee.name as 'Employee',Employee.salary as 'Salary'
from Employee
left join Department on Employee.departmentId = Department.id
where (Department.id, salary) in (select departmentId, max(salary)from Employeegroup by departmentId)