Execution problem between mysql max and where Execute sql: CREATE TABLE `grades` ( `id` int(20) NOT NULL AUTO_INCREMENT, `student_id` int(20) NOT NULL, `subject` 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`,`student_id`,`subject`,`grades`) values (1,1,'Chinese','80'),(2,1,'Mathematics','89'),(3,2,'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 (1,'xiaoming'),(2,'xiaohong'),(3,'xiaobai'); Execution Result: Execution result 1: Execution result 2: Execution result 3: Execution result 4: Execution result 5: It can be seen from this that: 1.max is executed before the where condition, 2. Group by is executed before max 3. When where and group by appear at the same time, the where condition is executed first Summarize The above is a summary of the execution problems between mysql max and where that I introduced to you. I hope it will be helpful to you. If you have any questions, please leave me a message and I will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website! You may also be interested in:
|
<<: Very practical Tomcat startup script implementation method
>>: Detailed explanation of the working principle and solution of Js modularization
Copy code The code is as follows: <!DOCTYPE ht...
Inject axios into Vue import axios from 'axio...
Concept introduction: We know that the redo log i...
Table of contents 1. Basics 2. Nodes, trees, and ...
2D transformations in CSS allow us to perform som...
Table of contents 1. Create objects by literal va...
How to install PHP7 on Linux? 1. Install dependen...
It’s National Day, and everyone is eager to celeb...
This is an effect created purely using CSS. To pu...
Business scenario: The visitor's visit status...
Recently I used MySQL to export table data to an ...
1 MySQL autocommit settings MySQL automatically c...
I accidentally found that Vue.$set was invalid in...
Starting from this section, we will explain the i...
[LeetCode] 197.Rising Temperature Given a Weather...