Company: Bank_Of_America
Difficulty: medium
Problem Description Write a SQL query to retrieve the names of employees who have an assigned teammate earning a strictly higher salary than they do. Schema Table: Employee CREATE TABLE Employee ( Emp_id INT PRIMARY KEY, Name VARCHAR(20) ); Table: Salary CREATE TABLE Salary ( Emp_id INT PRIMARY KEY, Salary INT, FOREIGN KEY (Emp_id) REFERENCES Employee(Emp_id) ); Table: Team_Mates CREATE TABLE Team_Mates ( Emp_id INT, Teammates_id INT, PRIMARY KEY (Emp_id, Teammates_id), FOREIGN KEY (Emp_id) REFERENCES Employee(Emp_id), FOREIGN KEY (Teammates_id) REFERENCES Employee(Emp_id) ); Required Output Your query should return a single column named Name . The results must be ordered by the qualifying teammate's salary amount in ascending order. Constraints or Notes It is guaranteed that no two employees have the exact same salary. If an employee has multiple teammates who earn a higher salary, the employee's name should appear in the result set once for each qualifying teammate. Examples Input Da