Skip to content

The wildcard at the wrong end

Two queries against an indexed name column:

sql -- A SELECT * FROM students WHERE name LIKE 'Ash%'; -- B SELECT * FROM students WHERE name LIKE '%sha';

Which can use the index, and why?