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...

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eb1eb3-46e13.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eb1eb3-46e13.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?