Bird
0
0

Which window function calculates the average value over a set of rows without collapsing the result into a single row?

easy📝 Conceptual Q2 of 15
PostgreSQL - Window Functions in PostgreSQL
Which window function calculates the average value over a set of rows without collapsing the result into a single row?
ASUM()
BAVG()
CCOUNT()
DAVG() OVER()
Step-by-Step Solution
Solution:
  1. Step 1: Identify AVG() OVER() behavior

    AVG() OVER() calculates the average for each row over a window without grouping rows into one.
  2. Step 2: Contrast with aggregate AVG()

    Aggregate AVG() returns a single average value for all rows, collapsing them.
  3. Final Answer:

    AVG() OVER() -> Option D
  4. Quick Check:

    AVG() OVER() = Average per window row [OK]
Quick Trick: Use OVER() to keep row details while averaging [OK]
Common Mistakes:
  • Using AVG() without OVER() expecting row-wise averages
  • Confusing SUM() with AVG()
  • Assuming COUNT() calculates averages

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes