question

erlokeshsharma08 avatar image
erlokeshsharma08 asked

<> or ! or NOT

Hi Folks Somebody asked me this in interviews. Which operator has highest performance : or ! or NOT Many Thanks Lokesh
performanceinterview-questionsoperator
5 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Kev Riley avatar image Kev Riley ♦♦ commented ·
and what did they say the answer was?
0 Likes 0 ·
Grant Fritchey avatar image Grant Fritchey ♦♦ commented ·
Under what circumstances? I wouldn't be able to tell you which of these operators performs better or worse without the query around it.
0 Likes 0 ·
KutangPan avatar image KutangPan commented ·
i tested something basic SELECT * FROM dbo.Test WHERE ID <> 13 SELECT * FROM dbo.Test WHERE ID != 13 SELECT * FROM dbo.Test WHERE NOT ID = 13 and I can't see any difference... I'm curious about the answer
0 Likes 0 ·
erlokeshsharma08 avatar image erlokeshsharma08 commented ·
Thanks for all the comments, I also got confused and began to wonder how can there be a performance improvement in using any one of the operators. @Kev - I didnt ask the answer :-) @Grant - Apologies, I dont have any particular sql for that.
0 Likes 0 ·
erlokeshsharma08 avatar image erlokeshsharma08 commented ·
Just an update on this, I think it would have been an oracle question because just came across some blogs which talk about != performing a little quicker than . Would like to know expert's opinion here.
0 Likes 0 ·

1 Answer

·
Nep avatar image
Nep answered
Would of thought the interview Q would be which one is standard and what are the benefits? in which case it would be the <> not really a performance Q as all have the same meaning.
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

erlokeshsharma08 avatar image erlokeshsharma08 commented ·
Yes I think he got it wrong and confused the heck out of me!!!
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.