Need help in understanding a SELECT query
- by Grant Smith
I have a following query. It uses only one table (Customers) from Northwind database.
I completely have no idea how does it work, and what its intention is. I hope there is a lot of DBAs here so I ask for explanation. particularly don't know what the OVER and PARTITION does here.
WITH NumberedWomen AS
(
    SELECT CustomerId ,ROW_NUMBER() OVER 
            (
                PARTITION BY c.Country 
                ORDER BY LEN(c.CompanyName) ASC
            ) 
                women 
                FROM Customers c
)
SELECT * FROM NumberedWomen WHERE women > 3 
If you needed the db schema, it is here