In which way the database processes:
Depending on the statement, the database may omit some of these steps.
SQL Engine - Query Optimizer (Query Optimization)
Query optimization is the process of choosing the most efficient means of executing a SQL statement. The database optimizes queries based on the optimizer statistics collected about the actual data being accessed.
The optimizer uses statistics such as :
to generate possible execution plans,
The database uses the plan with the lowest cost.