Leetcode SQL medium questions mainly.
Write a PostgreSQL query that returns every employee whose salary is the highest within their department. Include all employees tied for the highest salary. Employees without a department and departments without qualifying employees must not appear.
department_name, employee_name, and salarydepartment_name ascending, then employee_name ascending| Column | Type | Description |
|---|---|---|
| department_idPK | INT | Unique department identifier |
| department_name | VARCHAR(100) | Department name |
| Column | Type | Description |
|---|---|---|
| employee_idPK | INT | Unique employee identifier |
| employee_name | VARCHAR(100) | Employee name |
| department_id | INT | Department assigned to the employee |
| salary | DECIMAL(12,2) | Employee salary |