Consider the following relation:Works(emp_name, company_name,salary)
Here,emp name is primary key.
Consider the following SQL querySelect emp name
From works T
where salary > (select avg(salary)
from works S
where T. company name =
S. company name)
The above query is for following:
- AFind the highest paid employee who earns more than the average salary of all employees of his company.
- BFind the highest paid employee who earns more than the average salary of all the employees of all the companies.
- CFind all employees who earn more than the average salary of all employees all the companies.
- DFind all employees who earn more than the average salary of all employees of their company.