Try this
Run this on my data lake: SELECT region, SUM(amount) AS revenue, COUNT(*) FILTER (WHERE amount > 50) AS big_orders FROM samples.shop_orders GROUP BY ROLLUP(region) ORDER BY region
In plain words
What is it?
A few things that make common jobs shorter.
How does it work?
ROLLUP adds a grand total line. FILTER counts only matching rows. EXCLUDE drops a column from SELECT *.
Good to know
The grand total line has an empty region.
Then try
Best order in each region, without the customer
Run this on my data lake: SELECT * EXCLUDE (customer_id) FROM samples.shop_orders QUALIFY row_number() OVER (PARTITION BY region ORDER BY amount DESC) = 1