1Z0-909 · Question #18
Examine this statement which executes successfully: The table is populated with a range of values including jobs for Robert, John, and Katie. Now, examine this statement and output: Why is an empty…
The correct answer is C. The JSON datatype cannot be used in virtual columns. Option C is correct because MySQL does not support the JSON datatype as the defined type for a virtual/generated column - when you attempt to use it, the column produces no usable values, resulting in an empty result set even though the underlying table contains data. Option A…
Question
Examine this statement which executes successfully:
The table is populated with a range of values including jobs for Robert, John, and Katie. Now, examine this statement and output:
Why is an empty result set returned?
Exhibit
Options
- AThe select requires json_unquoteo in the where clause.
- BThe virtual values in the name column must be accessed using functions.
- CThe JSON datatype cannot be used in virtual columns.
- DThe json_extract() function requires a length value that matches the field length in the schema.
- ETable statistics must be updated to generate values for the name column.
How the community answered
(28 responses)- A4% (1)
- B29% (8)
- C46% (13)
- D14% (4)
- E7% (2)
Explanation
Option C is correct because MySQL does not support the JSON datatype as the defined type for a virtual/generated column - when you attempt to use it, the column produces no usable values, resulting in an empty result set even though the underlying table contains data. Option A is wrong because json_unquote() removes surrounding quotes from extracted JSON strings but is not a requirement for a WHERE clause to execute. Option B is wrong because virtual column values behave like regular columns and are directly accessible without wrapping them in functions at query time. Option D is wrong because json_extract() takes a JSON document and a path expression - there is no length parameter involved. Option E is wrong because table statistics affect the query optimizer's execution plan, not whether column values are physically accessible or returned.
Memory tip: Think of it as JSON is for storing, not for typing virtual columns - you can extract JSON values into a virtual column, but the virtual column itself must be declared as a concrete scalar type like VARCHAR or TEXT, never JSON.
Topics
Community Discussion
No community discussion yet for this question.
