SQL Query executes in a particular order. The Query execution is a shadow to any developer. In this post, I have explained the execution flow of the SQL query.
What is SQL compiler
The use of SQL compiler is it converts user written SQL statements using using SQL parsing engine and get us results from the RDBMS database.
Order of SQL statements
- FROM clause
- WHERE clause
- GROUP BY clause
- HAVING clause
- SELECT clause
- ORDER BY clause
SELECT id, language, author creator FROM proglang_tbl ORDER BY creator;
In the above SQL, first FROM executes, next SELECT and the last is ORDER BY. See the below video for all clauses.
Video on SQL Order of Execution
Why ORDER BY is Last
In any database, the ORDER BY executes at the end. That means Sorting takes place only at the end.
You must be logged in to post a comment.