Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the difference between HAVING and where in mysql

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report