I have just started exploring execution plans in SQL and I am not able to figure out how the query optimizer decides when to do a full table scan or index scan.
I ran several queries on the DB available in this link.
One of the query that i ran on employees table is,
select * from classicmodels.employees e where e.officeCode =1;
The employees table has officeCode as one of the indexes,
I guessed an index scan using officeCode would suffice, but, according to the execution plan, a full table scan was performed.
Can someone please explain why a full table scan was performed instead of an index scan?