EY INTERVIEW QUESTION | Rank Employees based on salary

-Question:

Rank employees based on max salary of the department. If the difference between the emp's salary and max salary is less than 10% then Average performer else worst performer.


 DROP TABLE IF EXISTS employees


CREATE TABLE employees (

    EmployeeID INT PRIMARY KEY,

    Name VARCHAR(50),

    Department VARCHAR(50),

    Salary DECIMAL(10, 2)

);



INSERT INTO employees (EmployeeID, Name, Department, Salary) VALUES 

(1, 'Alice', 'Sales', 5000.00),

(2, 'Bob', 'Sales', 6000.00),

(3, 'Charlie', 'Sales', 5500.00),

(4, 'David', 'Marketing', 6500.00),

(5, 'Eva', 'Marketing', 7000.00),

(6, 'Frank', 'Marketing', 6200.00),

(7, 'Grace', 'IT', 7500.00),

(8, 'Hank', 'IT', 7200.00);


SELECT * FROM employees

Comments

Popular posts from this blog

50 Essential SQL Questions to Land Your Dream Job

How to find all the customers who placed orders on three consecutive days | SQL Scenario questions

ACCENTURE SQL INTERVIEW QUESTION | Change the ProductIDs