I think you’re after something like this:
SELECT sno, MIN(grade) as mingrade, MAX(grade) AS maxgrade FROM scores GROUP BY sno HAVING MIN(grade) >= 70 AND MAX(grade) <= 90
but note that this will return the row that has a null value for “sno” because this row fits your criteria. You can always add
WHERE sno IS NOT NULL after the
FROM scores if you want to exclude that row.
NOTE: Obviously you can leave out the mingrade/maxgrade columns if you don’t wish to have them in the result set.
ADDITIONAL NOTE: I presume you are using SQLite? Most other SQL dialects complain about the syntax in your example because they expect an aggregate function to apply on the columns used in the HAVING clause.
For what it’s worth, there’s an online demo here
CLICK HERE to find out more related problems solutions.