What is the order in which the SQL query is executed?
The following is the order of executing SQL query:
The query goes to the shared pool that has information like parse tree and execution plan for the corresponding statement.
Then validates the SQL statement and validates the source(table).
Acquire locks.
Checks all the privileges.
Execute the query.
Fetch the values for SELECT statement
Displays the fetched values.
To sum up, the sequence is:
SELECT .........
FROM ..........
WHERE ..........
GROUP BY ...........
HAVING .............