edited by
4,036 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

8 votes
8 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.3k
views
4 answers
5 votes
go_editor asked Jun 17, 2016
5,280 views
Consider the following relational query on the above database:SELECT S.name FROM Suppliers S Where S.sid NOT IN (SELECT C.sid FROM Catalog C WHERE C.pid ... partsFind the names of all suppliers who have not supplied only non-blue part.
5.7k
views
3 answers
5 votes
go_editor asked Jun 17, 2016
5,671 views
The maximum length of an attribute of type text is$127$255$256$It is variable
4.0k
views
3 answers
7 votes
go_editor asked Jun 19, 2016
3,972 views
If a node has $K$ children in $B$ tree, then the node contains exactly _____ keys.$K^2$K-1$K+1$\sqrt{K}$
4.0k
views
2 answers
8 votes
go_editor asked Jun 17, 2016
3,979 views
Let $\text{R = (A, B, C, D, E, F)}$ ... following is a key of $\text{R}?$\text{CD}$\text{EC}$\text{AE}$\text{AC}$