Saturday, August 1, 2020

Find Employees Whose Salary is Higher Than 

Their Manager Salary

   Part - 14


YouTube Video Link:







Below are the Steps to solve the Question:

Step 1: Get Employee Salary from tblEmployee 

Step 2: Derive Manager Salary Using Manager id column by joining with tblEmployee (self join)

Step 3: Compare the Salaries of Employee and Manager

Here is the Query:

SELECT E.Empid, E.Empname , E.Salary AS EmpSalary, 
M.Empname AS MgrName, M.Salary AS MgrSalary 
FROM tblEmployee E 
JOIN tblEmployee M
ON E.Managerid = M.Empid
WHERE E.Salary > M.Salary





Please Subscribe :)

No comments:

Post a Comment

  Printing Number Pattern using SQL Link for video answer: SQL: --********************* --PRINT Pattern --********************* -- 1 -- ...