GATE CS 2004 · SQL Queries

MCQ · 1 mark · Problem DBMS-SQL-0143

The employee information in a company is stored in the relationEmployee (\(\underline{name}\), sex, salary, deptName)Consider the following SQL query select deptName
from Employee
where sex = 'M'
group by deptName
having avg (salary) > (select avg (salary) from Employee)
It returns the names of the department in which
  1. A
    the average salary is more than the average salary in the company
  2. B
    the average salary of male employees is more than the average salary of all male employees in the company
  3. C
    the average salary of male employees is more than the average salary of employees in the same department.
  4. D
    the average salary of male employees is more than the average salary in the company

Solve it on GATE DA practice →More Relational Model & SQL problems

Show the worked solutionOfficial GATE Answer Key: Option D.See full step-by-step discussion on GateOverflow: https://gateoverflow.in/1049/gate2004-53

GATE DA practice: past exam problems by chapter, with worked solutions · gatedaprep.com