Question

    Write a query to fetch department-wise count of employees sorted by department’s count in ascending order. EmployeeInfo is the table name.

    A SELECT Department, count(EmpID) AS EmpDeptCount FROM EmployeeInfo GROUP BY Department ORDER BY EmpDeptCount ASC; Correct Answer Incorrect Answer
    B SELECT Department, count(EmpID) AS EmpDeptCount FROM EmployeeInfo Order BY Department Group BY EmpDeptCount ASC; Correct Answer Incorrect Answer
    C SELECT Department, MAX(EmpID) AS EmpDeptMax FROM EmployeeInfo GROUP BY Department ORDER BY EmpDeptCount ASC; Correct Answer Incorrect Answer
    D SELECT Department, MAX(EmpID) AS EmpDeptCount FROM EmployeeInfo GROUP BY Department Group BY EmpDeptCount ASC; Correct Answer Incorrect Answer
    E None Correct Answer Incorrect Answer

    Solution

    The correct answer is A

    Practice Next