title: Which SQL is costlier and why?
body: <pre><code>Select DISTINCT Dept,SUM(Salary) OVER (PARTITION BY Dept) from Table
  
  Select Dept, SUM(Salary) FROM Table GROUP BY Dept
  </code></pre>
  <p>Both the above queries produce same result.
  In my opinion second query is costlier as it is using GROUP BY function which is costlier.
  Is it the correct explanation if ans is correct or is it something else?</p>