Summary of execution issues between mysql max and where, mysqlmax
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, 'subobject' 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', 'subobject', 'grades') values (, 'China', '80, 'mat', '89 '), (, 'China', '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 'studen' ('id', 'name') values (1, 'xiaoming'), (2, 'xiaohong '), (3, 'xiaoba ');
Execution result:
Result 1:
Result 2:
Result 3:
Result 4:
Result 5:
It can be seen that:
1. max is executed before the where condition,
2. group by is executed before max.
3. When both the where and group by statements give priority to where statements
Summary
The above is a summary of the execution problem between mysql max and where. I hope it will be helpful to you. If you have any questions, please leave a message for me, the editor will reply to you in a timely manner. Thank you very much for your support for the help House website!