Class - 12 CBSE Computer Science — Assertion Reason Type Questions
Assertion (A): All aggregate functions except count(*) ignore null values in their input collection.
Reasoning (R): SUM, AVG, MIN, and MAX can only be used with numeric columns.
- Both A and R are true and R is the correct explanation of A.
- Both A and R are true but R is not the correct explanation of A.
- A is true but R is false.
- A is false but R is true.
SQL Queries
1 Like
Answer
A is true but R is false.
Explanation
In SQL, aggregate functions like SUM, AVG, MIN, and MAX ignore NULL values in their calculations. The function COUNT(*), however, counts all rows along with NULL values in the table. The SUM and AVG functions can take arguments of only integer type, and can be used with numeric columns. While MAX and MIN functions can be used with various data types, including numeric, string, and datetime columns.
Answered By
3 Likes