Company N has call centers in Moscow and St. Petersburg, each of which employs several people. Due to the crisis, it was decided to lay off one employee in each city, and in order to maximize the savings, it was decided to cut the employee with the maximum salary for this city. If employees in the same city have the same salary, then a less experienced employee should be laid off, that is, one who got a job later. There are no employees with the same salary and date of employment in the company.
Get a list of employees to be made redundant.
The input table is Employees,
CREATE TABLE Employees
(
EmployeeID INT AUTO_INCREMENT PRIMARY KEY,
City NVARCHAR(50) NOT NULL,
EmployeeName NVARCHAR(100) NOT NULL,
EmployeeSalaryRub INT NOT NULL,
EmploymentDate DATE NOT NULL
);
The output should return the City and EmployeeName columns, sorted alphabetically by EmployeeName.