Home » MYSQL » MySQL GROUP BY » Question
  1. What is the significance of the statement “HAVING COUNT (emp_id)>2” in the given query?
    SELECT dep.name, COUNT (emp_id) emp_no
    FROM department dep INNER JOIN Employee em
    ON dep.dept_id=em.emp_id
    GROUP BY dep.name
    HAVING COUNT (emp_id) > 2
    1. Selecting those rows whose total emp_id > 2
    2. Filter out all rows whose total emp_id below 2 & Selecting those rows whose total emp_id > 2
    3. Filter out all rows whose total emp_id below 2
    4. All of above
    5. None of these
Correct Option: B

“HAVING” clause are worked similar as “WHERE” clause.



Your comments will be displayed only after manual approval.