Which aggregate function returns the average value for a numeric column, excluding NULLs?

Study for the SQL Basics Test. Improve your knowledge with multiple choice questions and detailed explanations. Prepare effectively to master SQL concepts!

Multiple Choice

Which aggregate function returns the average value for a numeric column, excluding NULLs?

Explanation:
Average value calculation is what this question tests: the function that yields the mean of a numeric column is AVG. It sums all non-null values and divides by the count of non-null values, so NULLs are ignored in the calculation. That’s why it returns the average rather than the total, or the maximum or minimum. For example, with values 3, 5, NULL, 7, the average is (3+5+7)/3 = 5. Sum would give 15, max would be 7, and min would be 3, illustrating the different results.

Average value calculation is what this question tests: the function that yields the mean of a numeric column is AVG. It sums all non-null values and divides by the count of non-null values, so NULLs are ignored in the calculation. That’s why it returns the average rather than the total, or the maximum or minimum. For example, with values 3, 5, NULL, 7, the average is (3+5+7)/3 = 5. Sum would give 15, max would be 7, and min would be 3, illustrating the different results.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy