πŸ“’ Too many exams? Don’t know which one suits you best? Book Your Free Expert πŸ‘‰ call Now!


    Question

    Which of the following SQL queries would return the

    total number of employees in each department, but only for departments with more than 10 employees?
    A 'SELECT department_id, COUNT(*) FROM employees GROUP BY department_id HAVING COUNT(*) > 10;' Correct Answer Incorrect Answer
    B 'SELECT department_id, COUNT(*) FROM employees WHERE COUNT(*) > 10 GROUP BY department_id;' Correct Answer Incorrect Answer
    C 'SELECT department_id, COUNT(*) FROM employees GROUP BY department_id ORDER BY COUNT(*) > 10;' Correct Answer Incorrect Answer
    D 'SELECT department_id, COUNT(*) FROM employees HAVING COUNT(*) > 10;' Correct Answer Incorrect Answer
    E 'SELECT department_id, COUNT(*) FROM employees WHERE department_id IN (SELECT department_id FROM employees GROUP BY department_id HAVING COUNT(*) > 10);' Correct Answer Incorrect Answer

    Solution

    'SELECT department_id, COUNT(*) FROM employees GROUP BY department_id HAVING COUNT(*) > 10;'

    Practice Next
    ask-question
    9