0

what is difference between

select * from dbo.persons where LastName='lkjh';
select * from dbo.persons where LastName like 'lkjh';

both retrieves the same values ,both uses exact values to retrieve dta not any patterns and which one is faster?

KVMSB
  • 1
  • 2
  • See Execution Plan https://technet.microsoft.com/en-us/library/ms178071(v=sql.105).aspx – Sankar May 25 '17 at 04:34
  • If you read the duplicate link, the verdict seems to be that `LIKE` _might_ be as fast as `=`, but not in all cases, and not in all databases. I think in general if your logic can proceed using equality checks, then you should lean towards using that. – Tim Biegeleisen May 25 '17 at 04:34
  • check this https://stackoverflow.com/questions/1003381/difference-between-like-and-in-mysql – kevin May 25 '17 at 04:47

0 Answers0