sql代码
insert into test values( ‘a1′,’b1’ ,1, ‘t’);
insert into test values( ‘a3′,’b3’ ,3, ‘t’);
insert into test values( ‘a4′,’b4’ ,4, ‘t’);
insert into test values( ‘a2′,’b2’ ,2, ‘t’);
insert into test values( ‘xx’,’xx’ ,5, ‘x’);
insert into test values( ‘a1′,’b1’ ,1, ‘t’);
insert into test values( ‘a3′,’b3’ ,3, ‘t’);
insert into test values( ‘a4′,’b4’ ,4, ‘t’);
insert into test values( ‘a2′,’b2’ ,2, ‘t’);
insert into test values( ‘xx’,’xx’ ,5, ‘x’);
commit;
1.select a,b, sum(c) from test where d= ‘t’ group by a,b order by a,b;
2.select a,b, sum(c) from test where d= ‘t’ group by b,a order by a,b;
总结:对于1,2而言,结果应该是一样的,但是分组的顺序不同,sql的性能应该也是不同的。
本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。
ctvol管理联系方式QQ:251552304
本文章地址:https://www.ctvol.com/dtteaching/802796.html