I've came to this conclusion that Like in below cases does seek/scan But I didn't get Why does it scan in 1st case and Seek in 2nd case. I understood the 3rd case.
SELECT c.contactname FROM Sales.Customers c
WHERE c.contactname LIKE '%a'-- Does a Scan 1st Case
SELECT c.contactname FROM Sales.Customers c
WHERE c.contactname LIKE 'a%'-- Does a Seek 2nd Case
SELECT c.contactname FROM Sales.Customers c
WHERE c.contactname LIKE '%a%'-- Does a Scan
If i build a index on contactname which has below sample data how would be the index tree.. like we if build for numbers it will compare less than greater than and will do traversing how index tree will be traverse in below case.
c.contactname
mark
anna
krishna
nadejda
allen
bob
cab