the groupby clause combines all records that have identical value in a particular field or a group of fields.
in 1st case only d sum condition will be checked
but in d 2nd the condition for each grade grouped will also be checked.
also in 2nd case the having clause is used since having clause works only wid groups.
hope im rite!!