it will be a bit annoying and verbose to compute stddev without "stddev" with datas(criteria, qty) as( values ('a', 1) ,('a', 2) , ('a', 3), ('a', 4) ,('a', 5), ('b',1), ('b',3) ) , intermed(criteria, squared) as (select criteria, power(qty-avg(qty) over (partition by criteria) , 2) from datas ) select criteria, sqrt(sum(squared)/count(*)) as stddev from intermed group by criteria