edited by
3,878 views
3 votes
3 votes

Consider the following schema:

$\textsf{Emp (Empcode, Name, Sex, Salary, Deptt)}$

A simple SQL query is executed as follows:

SELECT Deptt FROM Emp
GROUP by Dept
Having avg (Salary) > {select avg (Salary) from Emp}

The output will be

  1. Average salary of male employee is the average salary of the organization
  2. Average salary of male employee is less than the average salary of the organization
  3. Average salary of male employee is equal to the average salary of the organization
  4. Average salary of male employee is more than the average salary of the organization
edited by

1 Answer

7 votes
7 votes

Answer : D

Average salary of male employee is more than the average salary of the organization

select deptName 
from Employee 
where sex = 'Male'
group by deptName
having avg (salary) >   
(select avg (salary) from Employee)

Here we are going to get the name of all departments in which the average salary of male employees is greater than the average salary of all employees in the company. 

Answer:

Related questions

5 votes
5 votes
3 answers
2
go_editor asked Jun 17, 2016
5,502 views
The maximum length of an attribute of type text is$127$$255$$256$It is variable
7 votes
7 votes
3 answers
3
go_editor asked Jun 19, 2016
3,769 views
If a node has $K$ children in $B$ tree, then the node contains exactly _____ keys.$K^2$$K-1$$K+1$$\sqrt{K}$
8 votes
8 votes
2 answers
4