×

Loading...

help! SQL assignment due tomorrow...

Table EMPLOYEE has three fields: empname, deptname and empsalary, how to write the query to find the employee name whose salary is higher than the average salary of his department?

For example. the data look like this
EMPNAME EMPSALARY DEPTNAME
Mike 1000 A
Tom 1100 A
Jame 1800 A
Peter 2000 A
Bob 1900 B
Alice 2200 B
Ben 1000 B
Joe 1300 B

How to get this output:
Jame 1800 A
Peter 2000 A
Bob 1900 B
Alice 2200 B
Report

Replies, comments and Discussions: