๐Ÿ“ข Too many exams? Donโ€™t know which one suits you best? Book Your Free Expert ๐Ÿ‘‰ call Now!

  • google app store apple app store
  • โœ–

      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