Bird
0
0

What does the SQL function SUM(column_name) do in a PostgreSQL query?

easy📝 Conceptual Q1 of 15
PostgreSQL - Aggregate Functions and GROUP BY
What does the SQL function SUM(column_name) do in a PostgreSQL query?
ACalculates the average of the values in the column
BCounts the number of rows in the table
CFinds the smallest value in the column
DAdds all the values in the specified column
Step-by-Step Solution
Solution:
  1. Step 1: Understand the purpose of SUM()

    The SUM() function adds all numeric values in a column.
  2. Step 2: Compare with other aggregate functions

    COUNT counts rows, MIN finds smallest, AVG calculates average, so they differ from SUM.
  3. Final Answer:

    Adds all the values in the specified column -> Option D
  4. Quick Check:

    SUM() = Adds values [OK]
Quick Trick: SUM adds numbers, COUNT counts rows [OK]
Common Mistakes:
  • Confusing SUM with COUNT
  • Thinking SUM finds minimum
  • Using SUM on non-numeric columns

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes