Assume that category_id
is an index key (not primary key) of table books
. Is there any difference between the following two SQL statements?
No, the order of the WHERE clauses does not matter.
The optimizer reviews the query & determines the best means of getting the data based on indexes and such. Even if there were a covering index on the category_id and author columns - either would satisfy the criteria to use it (assuming there isn't something better).