您的位置:首页 > 房产 > 建筑 > 高德为什么没有国外地图_乐清本地网站_免费发布推广信息的平台_网站seo优化多少钱

高德为什么没有国外地图_乐清本地网站_免费发布推广信息的平台_网站seo优化多少钱

2024/10/7 0:06:47 来源:https://blog.csdn.net/TuringSnowy/article/details/142685551  浏览:    关键词:高德为什么没有国外地图_乐清本地网站_免费发布推广信息的平台_网站seo优化多少钱
高德为什么没有国外地图_乐清本地网站_免费发布推广信息的平台_网站seo优化多少钱
  1. Department Highest Salary

注意!要找出 tie 的 highest salary!

Write a solution to find employees who have the highest salary in each of the departments.

Return the result table in any order.

The result format is in the following example.

Input
Employee =

idnamesalarydepartmentId
1Joe700001
2Jim900001
3Henry800002
4Sam600002
5Max900001

Department =

idname
1IT
2Sales

Output

DepartmentEmployeesalary
ITJim90000
SalesHenry80000
ITMax90000

My wrong solution (didn’t find the tie):

-- WITH a AS (
--     SELECT departmentId AS di, name, MAX(salary) AS highest
--     FROM employee e
--     GROUP BY e.departmentId
-- )-- SELECT d.name AS Department, a.name AS Employee, a.highest AS Salary
-- FROM a
--     JOIN department d
--         ON a.di = d.id

Correct solution by others:

SELECT dp.name AS Department, em.name AS Employee, em.salary
FROM Employee AS em JOIN Department as dp ON em.departmentId = dp.id 
WHERE em.salary = (SELECT MAX(salary) FROM Employee WHERE departmentId = dp.id )

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com