nerdexam
Oracle

1Z0-909 · Question #9

Examine the layout of the my_values table. Examine the data in the my_value3 table. Examine this statement: A. B. C. D.

The correct answer is B. | total | +-------+ | 10205 |. Option B is correct because MySQL's default behavior treats division by zero as NULL for that individual row, and aggregate functions like SUM() silently ignore NULL values - so the remaining valid rows are summed, producing 10205. Why the distractors are wrong: A (NULL) would…

SQL Fundamentals

Question

Examine the layout of the my_values table. Examine the data in the my_value3 table. Examine this statement:

A. B. C. D.

Exhibits

1Z0-909 question #9 exhibit 1
1Z0-909 question #9 exhibit 2

Options

  • A| total | +-------+ | NULL |
  • B| total | +-------+ | 10205 |
  • C| total | +-------+ | 0 |
  • D| Level | Code | Message | +---------+------+-------------+ | Warning | 1365 | Division by 0 |

How the community answered

(23 responses)
  • A
    9% (2)
  • B
    87% (20)
  • D
    4% (1)

Explanation

Option B is correct because MySQL's default behavior treats division by zero as NULL for that individual row, and aggregate functions like SUM() silently ignore NULL values - so the remaining valid rows are summed, producing 10205.

Why the distractors are wrong:

  • A (NULL) would only be correct if all rows produced NULL (e.g., every denominator were zero), but the data contains valid non-zero rows that contribute to the sum.
  • C (0) is incorrect because SUM() doesn't treat NULL as zero - it skips NULL rows entirely rather than counting them as 0.
  • D (Warning) is wrong because MySQL's default SQL mode does not raise a Division by Zero warning for expressions inside aggregate functions; that behavior requires strict mode or specific SQL mode flags.

Memory tip: Think of MySQL's division-by-zero rule as "NULL and move on" - the bad row disappears from the aggregate, and the rest of the calculation proceeds normally. If you see a warning option on the exam, it's almost always a trap unless the question specifically mentions STRICT or ERROR_FOR_DIVISION_BY_ZERO SQL modes.

Topics

#table structure#column layout#data types

Community Discussion

No community discussion yet for this question.

Full 1Z0-909 Practice