Assume that category_id
is an index key (not primary key) of table books
. Is there any difference between the following two SQL statements?
Yes, SQL is a declarative language. But in SQL Server (not sure about other engines) a DBA can actually (kinda) do this, by forcing an execution plan in SQL Query Store.
But, yeah, you can't control it from your app, or from within the query text itself.
P.S. 2 more cents: you can control the order of JOIN's by using FORCE ORDER
.