Suppose you have an Employee table with id, name, salary, deptid; fetch employees who are toppers in their own department and write the SQL query.
Treat all employees tied for the highest salary in a department as toppers. Exclude employees without a department or salary.
id, name, salary, and deptiddeptid ascending, then id ascending| Column | Type | Description |
|---|---|---|
| idPK | INT | Unique employee identifier |
| name | VARCHAR(100) | Employee name |
| salary | INT | Employee salary |
| deptid | INT | Department identifier |