摘要: 部门工资最高的员工 select d.name as Department, e.name as Employee, e.salary as Salary from Employee e left join Department d on e.departmentId = d.id where (e 阅读全文
posted @ 2023-04-11 16:06 Carl_ZhangJH 阅读(14) 评论(0) 推荐(0)
摘要: 从不订购的客户 select c.Name as Customers from Customers c left join Orders o on c.Id = o.CustomerId where o.CustomerId is null select customers.name custome 阅读全文
posted @ 2023-04-11 15:54 Carl_ZhangJH 阅读(12) 评论(0) 推荐(0)
摘要: 查找重复的电子邮箱 对于mysql来说 inner join 就是在做笛卡尔积 select email as Email from Person group by email having count(email) > 1 select email as Email from ( select e 阅读全文
posted @ 2023-04-11 15:44 Carl_ZhangJH 阅读(10) 评论(0) 推荐(0)
摘要: 超过经理收入的员工 select e1.name as Employee from Employee e1, Employee e2 where e1.managerId = e2.id and e1.salary > e2.salary select e1.name as Employee fro 阅读全文
posted @ 2023-04-11 15:19 Carl_ZhangJH 阅读(12) 评论(0) 推荐(0)
摘要: 连续出现的数字 select distinct l1.num as ConsecutiveNums from Logs l1, Logs l2, Logs l3 where l1.id = l2.id - 1 and l2.id = l3.id - 1 and l1.num = l2.num and 阅读全文
posted @ 2023-04-11 12:24 Carl_ZhangJH 阅读(12) 评论(0) 推荐(0)