views:

22

answers:

1

i have an innodb mysql table with a varchar(100) field called 'word'.

i created a btree index on an that field.

if i do a query like select * from table where word = 'non-linear', i get all variations of that word. so results would include (Non-linear, Non-Linear, non-Linear, etc...).

it seems to me that that index doesnt care about the capitalization.

does this mean that the index has 1 record for this word?

if so, is there a way to get a list of all the keys in the index so that i would essentially have a list of unique terms?

+1  A: 

String comparisons are not case-sensitive for non-binary data types like varchar, char, text. For binary strings (BINARY, VARBINARY, BLOB), comparisons use the numeric values of the bytes in the operands; this means that for alphabetic characters, comparisons will be case sensitive.

More information available at Mysql Docs.

Faisal Feroz
Thanks, this was helpful enough to answer my first question regarding case sensitivity. I am still unclear if there is a way to get the actual values out of an index.
britt
The keys in the index are created from the data you build the index on. It isn't like every combination, the keys are the data that is present. In your case if you created an index on varchar column having data ABC, abc and AbC. Then since all these are equal if you are not using binary then the key would be ABC only and this will have the values ABC, abc and AbC.
Faisal Feroz