What is the difference between HAVING and where in mysql
This article mainly introduces what is the difference between HAVING and where in mysql. It has a certain reference value, and interested friends can refer to it. I hope you can learn a lot after reading this article.
Having and where conditional expressions are used for development using MySQL (MaraiDB). Here is a note of the difference between the two conditional expressions.
Code example:
SELECT * FROM student WHERE stu_age BETWEEN 20 AND 25 AND stu_sex = FALSE;SELECT usersex,COUNT (*) FROM login GROUP BY usersex HAVING COUNT (usersex) > 5
As in the first statement above, where is used to judge the condition, and the second statement is used to judge the condition through having.
Both Having and where expressions are used to limit display, but they work differently. Where conditional expressions act on tables or views and are query conditions for tables and views. The Having conditional expression acts on the grouped record to select the group that meets the condition.
Thank you for reading this article carefully. I hope the article "what's the difference between HAVING and where in mysql" shared by the editor will be helpful to you. At the same time, I also hope you will support us and follow the industry information channel. More related knowledge is waiting for you to learn!