Assume that category_id
is an index key (not primary key) of table books
. Is there any difference between the following two SQL statements?
SELECT * FROM books WHERE author='Bill' AND category_id=1
SELECT * FROM books WHERE category_id=1 AND author='Bill'
I guess filtering records first by category_id
and then by author
is faster than filtering them in reverse order. Are SQL engines smart enough to do it this way?