Home » Database » Database miscellaneous » Question

Database miscellaneous

  1. The employee information in a company is stored in the relation
    Employee (name, sex, salary, deptName)
    Consider the following SQL query :
        Select deptName
          From Employee
          Where sex = ‘M’
          Group by deptName
          Having avg(salary) >
             (select avtg (salary) from Employee)
    It returns the name of the department in which

    1. the average salary is more than the average salary in the company
    2. the average salary of male employees is more than the average salary of all male employees in the company the
    3. average salary of male employees is more than the average salary of employees in the same department
    4. the average salary of male employees is more than the average salary in the company
Correct Option: D

SQL query will compute as follows
1. Selects the name from the department
2. Selects the male employee
3. Computes that the average salary of male employees is more than the average salary in the company.



Your comments will be displayed only after manual approval.