>>>>When creating a unique index and FK constraint on two columns, does the order of columns matter?
>>>>
>>>>For example, I want to have unique index on SITE_NO (Int) and CATEGORY (Char(20) and a FK Constraint on these two fields. Would [SITE_NO],[CATEGORY] create different "results" from [CATEGORY],[SITE_NO]?
>>>>
>>>>TIA
>>>
>>>Yes, order of columns matter in the index. Select most selective column first.
>>
>>What do you mean by "most selective"?
>
>If you have many categories and just few sites, then using Category as first column in the index may help with the queries. If it's the opposite situation of column's selectivity, then the index should start with the SiteNo column.
Thank you.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham