Which aggregate function returns the minimum value in a 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 minimum value in a column, excluding NULLs?

Explanation:
You're being tested on how SQL handles aggregate functions with missing data. The minimum value in a column is found using the minimum function, which considers only non-NULL values and returns the smallest among them. NULLs are ignored by aggregate computations, so they don’t affect the result. For example, with values 3, 7, NULL, and 2, the minimum is 2. The other functions don’t provide the minimum: maximum gives the largest non-NULL value, average computes the mean of non-NULL values, and sum adds up non-NULL values. So the function that returns the minimum value while excluding NULLs is the minimum function.

You're being tested on how SQL handles aggregate functions with missing data. The minimum value in a column is found using the minimum function, which considers only non-NULL values and returns the smallest among them. NULLs are ignored by aggregate computations, so they don’t affect the result. For example, with values 3, 7, NULL, and 2, the minimum is 2. The other functions don’t provide the minimum: maximum gives the largest non-NULL value, average computes the mean of non-NULL values, and sum adds up non-NULL values. So the function that returns the minimum value while excluding NULLs is the minimum function.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy