Bird
0
0

In SQL, what result does the expression SUM(amount) OVER () produce when used in a SELECT statement?

easy📝 Conceptual Q1 of 15
SQL - Advanced Window Functions
In SQL, what result does the expression SUM(amount) OVER () produce when used in a SELECT statement?
AThe sum of <code>amount</code> for each distinct group defined by a partition
BThe total sum of the <code>amount</code> column across all rows
CThe cumulative sum of <code>amount</code> ordered by a column
DThe average of the <code>amount</code> column over all rows
Step-by-Step Solution
Solution:
  1. Step 1: Understand the window function syntax

    SUM(amount) OVER () means sum over all rows without partitioning or ordering.
  2. Step 2: Effect of empty OVER clause

    Empty parentheses indicate the window includes all rows in the result set.
  3. Final Answer:

    The total sum of the amount column across all rows -> Option B
  4. Quick Check:

    SUM with empty OVER returns total sum [OK]
Quick Trick: Empty OVER() sums entire column [OK]
Common Mistakes:
  • Confusing OVER() with PARTITION BY
  • Assuming it calculates cumulative sum
  • Thinking it averages values

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes