title: DISTINCT with PARTITION BY vs. GROUPBY
body: <p>I have found some SQL queries in an application I am examining like this:</p>
  
  <pre><code>SELECT DISTINCT
  Company, Warehouse, Item,
  SUM(quantity) OVER (PARTITION BY Company, Warehouse, Item) AS stock
  </code></pre>
  
  <p>I'm quite sure this gives the same result as:</p>
  
  <pre><code>SELECT
  Company, Warehouse, Item,
  SUM(quantity) AS stock
  GROUP BY Company, Warehouse, Item
  </code></pre>
  
  <p>Is there any benefit (performance, readability, additional flexibility in writing the query, maintainability, etc.) of using the first approach over the later?</p>