Skip to content
CodeKruPro

Window function or GROUP BY?

QuizMedium

What is the main difference between SUM(salary) OVER (PARTITION BY dept_id) and SUM(salary) ... GROUP BY dept_id?

  • The window version keeps every employee row and adds the department total to each; GROUP BY returns one row per department
  • They return the same rows
  • The window version can only be used with ORDER BY
  • Window functions are allowed in WHERE

This question is part of Pro+

Pro+ opens every question in Interview Prep and the mock interview. Every article and the first 2 questions of each topic stay free. Hands-on Selenium and API tasks follow their course lesson's own lock.

See Pro+

Already have Pro+? Sign in