partition by sql server
-- When using an aggregation function (SUM, COUNT, RANK, etc...)
-- Creates a specification on which you need to perform that agreggation
-- Example:
SELECT Customercity,
SUM(Orderamount) OVER(PARTITION BY Customercity) AS SumOrderAmount
-- performs avg amount when and only when you see a customer city
-- Orderamount | Customercity --(Comment added)-- | SumOrderAmount
-- 100 | Chicago "partition1" | 250
-- 150 | Chigago "partition1" | 250
-- 50 | Houston "partition2" | 75
-- 25 | Houston "partition2" | 75