Bird
0
0

Which clause is necessary inside SUM() OVER() to calculate a running total in order?

easy📝 Conceptual Q2 of 15
SQL - Advanced Window Functions
Which clause is necessary inside SUM() OVER() to calculate a running total in order?
AWHERE
BGROUP BY
CHAVING
DORDER BY
Step-by-Step Solution
Solution:
  1. Step 1: Identify the role of ORDER BY in window functions

    ORDER BY inside OVER defines the order of rows for cumulative calculations.
  2. Step 2: Compare with other clauses

    GROUP BY groups rows but does not define order; WHERE and HAVING filter rows.
  3. Final Answer:

    ORDER BY -> Option D
  4. Quick Check:

    Running total needs ORDER BY inside OVER [OK]
Quick Trick: Use ORDER BY inside OVER for running totals [OK]
Common Mistakes:
  • Using GROUP BY instead of ORDER BY inside OVER
  • Confusing WHERE with ordering
  • Omitting ORDER BY clause

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes