有兩張表:
employee 表
department 表
要求找出每個部門工資最高的人的 姓名、所在部門、工資。
查詢結果如圖,
sql語句爲:
select department.name Department,employee.name Employee,max(salary) Salary from employee
inner JOIN department on employee.department = department.id group by department