1Z0-888 · Question #78
1Z0-888 Question #78: Real Exam Question with Answer & Explanation
The correct answer is B. No indexed columns are used to select rows from the City table. The world.City.CountryCode column is used to select rows in the Country table.. In MySQL's EXPLAIN output, the ref column shows which column or value is compared against the index to retrieve rows from that table. Here, the City table has NULL in its ref column (meaning no index lookup was used to select its rows - it's the driving/outer table scanned direct
Question
Options
- Aworld.City.CountryCode is used as the primary key for the Country table.
- BNo indexed columns are used to select rows from the City table. The world.City.CountryCode column is used to select rows in the Country table.
- Cworld.City.CountryCode is used to sort the rows in the City table.
- DNo indexed columns are used to select rows from the Country table. The world.City.CountryCode column is used to select rows in the City table.
Explanation
In MySQL's EXPLAIN output, the ref column shows which column or value is compared against the index to retrieve rows from that table. Here, the City table has NULL in its ref column (meaning no index lookup was used to select its rows - it's the driving/outer table scanned directly), while the Country table shows world.City.CountryCode in its ref column - meaning each row in Country is looked up using the CountryCode value from the City table.
Why the distractors fail:
- A misidentifies the
refcolumn's purpose - it describes join lookup input, not primary key definition. - C conflates
refwithORDER BYlogic; therefcolumn has nothing to do with sorting. - D reverses the tables - it's Country rows being selected via
City.CountryCode, not City rows being selected via a Country column.
Memory tip: Think of ref as "what reference was used to find rows in this table." A NULL means no reference (full scan or driving table); a column name like world.City.CountryCode means that column's value was the key used to probe the index of the current table in the join.
Topics
Community Discussion
No community discussion yet for this question.