Very basic question. I was reading the MCTS 70-433 training kit book from Microsoft, and fairly early on, they make a claim which I don't really fully believe.
In it, they claim that the use of the NOT operator makes indexes unusable for the query optimiser. However, I'm sure that I've regularly used NOT and had no problem with the optimiser using indexes. IE:
WHERE ID NOT IN (1, 2, 3, 4, 5)
I have a feeling that the statement was just a generalized claim, since the following query clearly would not use an index seek:
WHERE NOT (ID = 5 AND Name = 'Andrew')
Since, because of the NOT operator and the way boolean logic works, that query translates into an OR (WHERE ID <> 5 OR Name <> 'Andrew').
So, is the claim in the book incorrect?