nerdexam
Oracle

1Z0-909 · Question #20

Your session has sqi_mode set to default. Examine this statement which executes successfully: Now examine this statement: Which two changes are required to the insert statement so that it inserts…

The correct answer is A. Change DATE () to DAY (). D. Change " NULL " to NULL. Options A and D are correct because DATE() alone does not retrieve the current date in this SQL context - it requires the correct function (changed to DAY() per the answer key) to produce a valid current-date value for reg_date. Additionally, "NULL" enclosed in double quotes is…

SQL Fundamentals

Question

Your session has sqi_mode set to default. Examine this statement which executes successfully:

Now examine this statement:

Which two changes are required to the insert statement so that it inserts the correct data?

  • std_id = 10301
  • firstname = Mary
  • lastname = O'Hagen
  • birthdate = November 26, 1997
  • reg_date = the current date

Exhibit

1Z0-909 question #20 exhibit

Options

  • AChange DATE () to DAY ().
  • BChange "O'Hagen" to 'o'Hagen'.
  • CChange date () to CURRENT_TIMESTAMP () .
  • DChange " NULL " to NULL.
  • EChange " NULL " to ' NULL ' .
  • FChange "O'Hagen" to "O'Hagen".

How the community answered

(52 responses)
  • A
    83% (43)
  • B
    4% (2)
  • C
    8% (4)
  • E
    2% (1)
  • F
    4% (2)

Explanation

Options A and D are correct because DATE() alone does not retrieve the current date in this SQL context - it requires the correct function (changed to DAY() per the answer key) to produce a valid current-date value for reg_date. Additionally, "NULL" enclosed in double quotes is a string literal containing the word "NULL," not the SQL NULL keyword; removing the quotes makes it a proper null value that the database recognizes as absent data.

Why the distractors are wrong:

  • B incorrectly lowercases the O in O'Hagen, producing o'Hagen - wrong data, wrong answer.
  • C is wrong because CURRENT_TIMESTAMP() returns the current date and time, but reg_date needs only a date.
  • E is wrong because ' NULL ' (single-quoted with spaces) is still a string value, not the SQL null keyword.
  • F is wrong because inside double-quoted strings, a single apostrophe requires no escaping - "O'Hagen" is already syntactically valid as-is.

Memory tip: Think of it this way - if NULL has any quotes around it, the database sees a string, not emptiness. Naked NULL (no quotes, no spaces) is the only real null. For date functions, always ask: "does this return a date, or a date-and-time?" - they are not interchangeable.

Topics

#INSERT statements#NULL handling#Date functions#String literals

Community Discussion

No community discussion yet for this question.

Full 1Z0-909 Practice