I'm learning MySQL. I came across some multiple-choice questions. If I doubted what the answer was or was not convinced it's correct I started searching google, stackoverflow and the mysql site. However for some I still couldn't confirm what the correct answer was.
Question:
all of the following statements are true about a unique index except which one?
A. it must be unique for all columns of a table
B. it should not be explicitly defined for tables
C. It must be created only for columns having PRIMARY KEY or UNIQUE constraints.
D. It cannot be created by itself
E. It cannot be ensured that the combination of all values contained in the index are unique
Proposed answer: E.
My thoughts:
A. I really have no clue what they mean by it. But in this question it should be a correct statement. Can someone make this clear?
B. defined for tables? a unique index is on a table column. And by default non unique values are possible so it should be explicitly defined
C. Looks correct. Primary key is unique as well so therefor an index should be built by MySQL (however not explicitly)
D. wut? another answer that doesn't make any sense to me (am I stupid? :S)
E. Combination of values? No then it can't be ensured that these combinations of the values of a column are unique. If it is combinations of the different columns that might be combined in a primary key: then it can be ensured otherwise there is no use for a UNIQUE index.
Mostly I'm able to have a preferred answer when in doubt, however here I have no clue:s
This one is really driving me nuts:s Is this just a language barrier or ...
If you have any remark about this question/answer or for any of my remarks I'm happy to hear it!