MySQL
易意逸
软件
展开
-
LeetCode 185部门工资前三高的所有员工(MySQL)
select d.name as Department, e.Name as Employee, Salary from Employee e join Department d on e.DepartmentId = d.Id where 3 > (SELECT COUNT(DISTINCT e1.Salary) FROM Employee e1 WHERE e1.Salary > e..原创 2020-05-14 14:00:26 · 270 阅读 · 0 评论 -
LeetCode 184 部门工资最高的员工(MySQL)
select d.Name as Department, e.Name as Employee, Salary from Employee e join Department d on e.DepartmentId = d.id where (e.DepartmentId, Salary ) in (select DepartmentId, Max(Salary) from Employee GROUP by DepartmentId);原创 2020-05-14 14:00:36 · 119 阅读 · 0 评论 -
LeetCode 183从不订购的客户(MySQL)
4 从不订购的客户select c.Name as Customers from Customers c where id not in (select c.id from Customers c join Orders o on o.CustomerId = c.id);原创 2020-05-14 14:00:46 · 118 阅读 · 0 评论 -
LeetCode 182 查找重复的电子邮箱(MySQL)
3 查找重复的电子邮箱:题解: 应用聚合函数havingselect Email from Person group by Email having count(Email) >1;原创 2020-05-14 14:00:13 · 234 阅读 · 0 评论 -
LeetCode 181 超过经理收入的员工(MySQL)
超过经理收入的员工select e2.Name as 'Employee' from Employee e1 left join Employee e2 on e2.ManagerId = e1.Id where e2.Salary > e1.Salary;原创 2020-05-14 14:01:06 · 139 阅读 · 0 评论 -
MySQL中TIMESTAMPDIFF与DATEDIFF的用法区别
DATEDIFF: DATEDIFF() 函数返回两个日期之间的天数。TIMESTAMPDIFF:原创 2020-05-08 14:30:00 · 992 阅读 · 1 评论