sql - Multiple count() invocations with the same argument in one query -


suppose have table persons:

create table persons (      id integer,      age integer,      primary key (id) ); 

is there difference between following 2 queries?

query #1:

select age, count(*)  persons  group age  order count(*); 

query #2:

select age, count(*) cnt  persons  group age  order cnt; 

will first query count() twice, or optimized away query planner? depend on vendor or defined standard?

both query have same effect.

if run both these query parallel ,query cost showing same.

enter image description here


Comments

Popular posts from this blog

serialization - Convert Any type in scala to Array[Byte] and back -

Slow performance first queries on SQL Azure -

Java Entity Manager - JSON reader was expecting a value but found 'db' -