Snowflake — LISTAGG (&Copilot)

3 min readMay 14, 2024

We have a requirement where we want to see the top customers with the largest orders. This could lead to a query like this:

select o_custkey customer
, sum(o_totalprice) total_sales
, row_number() over (order by total_sales desc) rank
from snowflake_sample_data.tpch_sf1.orders o
join snowflake_sample_data.tpch_sf1.customer c
on o.o_custkey = c.c_custkey
group by all;
Customers ranked




I am a freelance data engineer. My main focus is Snowflake, but I am always eager to learn new things. Python and AWS are my main side interests