Using Subquery
\nselect max(e2.salary) from employee e2 where e2.departmentid = e.departmentid\n\nthis query will give maximum salary for one departmentId\nand use this result
```\nselect max(e2.salary) from employee e2 where e2.departmentid = e.departmentid\n```\nthis query will give maximum salary for one departmentId\nand use this result to our main query so the result will be like below:\n\n```\nselect d.name as Department, e.name as Employee, e.salary as Salary\nfrom department d , Employee e\nwhere e.departmentId = d.id\nand e.salary = (\n    select max(e2.salary) from employee e2 where e2.departmentid = e.departmentid\n);\n```\nHit like if you find this helpful!\n
[]