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

Example Analysis of execution problems between max and where in mysql

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces the example analysis of the execution problems between max and where in mysql. The article is very detailed and has certain reference value. Interested friends must read it!

Implementation problems between mysql max and where

Perform sql:

CREATE TABLE `grades` (`id` int (20) NOT NULL AUTO_INCREMENT, `grades` int (20) NOT NULL, `grat` varchar (20) COLLATE utf8_bin DEFAULT NULL, `grades` varchar (20) COLLATE utf8_bin DEFAULT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;insert into `grades` (`id`, `gradesid`, `grat`, `grades`) values (1par 1pl 'Chinese', '80'), (2LQ' math', '89'), (3Jing' 2Zhi 'Chinese', '90') CREATE TABLE `student` (`id` int (20) NOT NULL AUTO_INCREMENT, `name` varchar (20) COLLATE utf8_bin DEFAULT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;insert into `student` (`id`, `name`) values

Execution result:

Implementation result 1:

Implementation result 2:

Implementation result 3:

Implementation result 4:

Implementation result 5:

Thus it can be seen that:

1.max is executed before the where condition

two。 And group by was executed before max.

3. When where and group by appear at the same time, the where condition is executed first.

The above is all the contents of the article "example Analysis of execution problems between max and where in mysql". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

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: 273

*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

Database

Wechat

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

12
Report