Referencing label from Select clause in where, simple sql query Consider I'm having a query such as:

SELECT student.name, MAX(grades.final_grade) as max_grade
From grades , students
where student.id == grade.student_id and max_grade == 90

Is this query wrong and won't work, because it's illegal to acess label mentioned in select in a where clause?
"Aggregates" cannot be referenced in WHERE.  But they can be moved to HAVING:

SELECT  student.name, MAX(grades.final_grade) as max_grade
    From  grades , students
    where  student.id = grade.student_id
    HAVING  max_grade = 90


Also it is =, not ==.