NULL Handling · Question 4 · Easy

NULL Handling question 4

Table Staff:
id | name | dept | bonus
1 | Anita | HR | 5000
2 | Bhavesh | IT | NULL
3 | Charu | IT | 8000
4 | Deepak | Sales | NULL
5 | Esha | HR | 3000

What do MIN and MAX return here?

SELECT MIN(bonus), MAX(bonus)
FROM Staff;
  1. NULL, 8000
  2. 3000, 8000
  3. 0, 8000
  4. NULL, NULL
Answer and explanation

Answer: B. 3000, 8000

Explanation: MIN and MAX ignore NULLs and work only on the known values 5000, 8000 and 3000. A NULL is not treated as 0 and does not make the answer NULL.

Previous: Table Staff: id | name | dept | bonus 1 | Anita | HR | 5000 2 | Bhavesh | IT |… · Next: Table Staff: id | name | dept | bonus 1 | Anita | HR | 5000 2 | Bhavesh | IT |…

Practise null handling

Try a fresh set of null handling questions with an explanation after every answer, free and without signing up: NULL Handling practice. Or sit a full placement mock test.

More null handling questions

More sql practice

SQL Functions & CASE · UNION, INTERSECT & EXCEPT · Tables, Keys & Constraints · DML & Transactions · SELECT, WHERE & ORDER BY · SQL Joins · Aggregates & GROUP BY · Subqueries & CTEs

LogicWiz Exams home · All practice topics · Placement mock tests · Daily 10 challenge