Why does select student_id from score having num < 60 in MySQL5.7 report an error?

problem description

Why the ID (student_id) of students who fail in my score table (num < 60) cannot use having select student_id from score having num < 60; can only use select student_id from score where num < 60 ;

the environmental background of the problems and what methods you have tried

mysql5.7

error message

clipboard.png

expectation

I want to know the principle of error reporting

May.31,2022

having filters the returned results. There is no num in the returned results. You can filter

by adding num to the returned results.

clipboard.png
correctly understand the difference between where and having in MySQL https://blog.csdn.net/yexuden...

Menu