recategorized by
3,510 views
0 votes
0 votes

The employee information of an organization is stored in a relation: Employee (name, sex, salary, deptname). Consider the following SQL query:

Select deptname from Employee where sex=’M’ group by dept name having 
avg (salary) > {select avg (salary) from Employee}

Output of the given query corresponds to

  1. Average salary of employee more than average salary of the organization
  2. Average salary of employee less than average salary of the organization
  3. Average salary of employee equal to average salary of the organization
  4. Average salary of male employees in a department is more than average salary of the organization
recategorized by

2 Answers

Best answer
6 votes
6 votes

Answer : D

Select deptname

it says we are selecting Department.

from Employee

Both above put together says we are selecting Dept name just by considering employee Table

where sex=’M

It says we are selecting Male Employee.

 group by dept name having 
avg (salary) 

it says we are grouping all the male employee in a Department whose avg salary is something

> {select avg (salary) from Employee}

This Last Comparison says we have selected something which is greater then the right side of comparison Operator

So What we have selected is

Average salary of male employees in a department is more than average salary of the organization

selected by
1 votes
1 votes

Option(D).Average salary of male employees in a department is more than average salary of the organization

Answer:

Related questions

3 votes
3 votes
2 answers
1
5 votes
5 votes
3 answers
3
0 votes
0 votes
1 answer
4