Sql

Roma X.

asked • 10/10/21

SQL employee database question


Find all the employees salary records where the salary amount is greater than his/her average salary. Display employee's first name, last name, salary amount, from and to date.

2 Answers By Expert Tutors

By:

Krushna D. answered • 01/01/22

Tutor
New to Wyzant

Be a MSSQL expert developer

Dhaval D. answered • 11/09/21

Tutor
4.7 (10)

Oracle PL/SQL expert with 16+ years working experience

Krushna D.

in the table multiple entries for a employee .need to find avg against of each employee. then join with the main table with employee as emp.first_name=avg.first_name and emp.last_name=avg.last_name and emp.salary>avg.avgsalary
Report

01/01/22

Krushna D.

select emp.first_name,emp.Last_name,emp.Salary,emp.FromDate,emp.Todate from Employee emp inner join (select First_Name,Last_Name,avg(salary) as avgsalary from Employee emp1 group by First_Name,Last_Name)avgd on emp.First_Name=avg.First_Name and emp.Last_Name=avg.Last_Name and emp.Salary>avgd.avgsalary
Report

01/01/22

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.