Error: Invalid Use of Group Function

SELECT * FROM school WHERE SUM(student)>=18

SELECT * FROM school HAVING SUM(student)>=18

it shows only the first row of dat. Not all the rows where student>=18

SELECT
       sum( case when student >=18  then 1 else 0 end ) 
           as Sm
FROM school