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
1. First, double-click the vmware icon on the com...
This article example shares the specific code of ...
Set a background image for the table. You can use...
Table of contents The role of foreign keys mysql ...
The application scenario is: the iframe page has n...
TABLE> <TR> <TD> <TH> <CA...
Table of contents 1. Prerequisites 1.1 Supported ...
The CSS counter attribute is supported by almost ...
1. Install cmake 1. Unzip the cmake compressed pa...
Generally, during the development process, the su...
In order to avoid repeatedly entering the Docker ...
How to define complex components (class component...
Recently, I learned about the Vue project and cam...
1. docker ps -a view the running image process [r...
In most application scenarios, we need to back up...