SQL Query – Order of execution Posted in SQL Tutorials by Chandrasekhar Raparthi On March 9, 2014. 2 Comments Order of execution When you execute a SQL Query, it will be executed in the following sequence. FROM ON JOIN WHERE GROUP BY HAVING SELECT DISTINCT ORDER BY TOP Share this:GooglePinterestEmailTwitterLinkedInFacebook Tags:Order of execution,SQL Query - Order of execution Related Posts The TOP Clause TOP The TOP clause is used to return top SELECT Distinct Distinct The DISTINCT keyword eliminates duplicate records in a Flat File DBMS (FDBMS) Flat File Database A flat file database is a Latest Comments December 17, 2014 Andy I have seen in some community posts that -“SQL has no order of execution. Is a declarative language. The optimizer is free to choose any order it feels appropriate to produce the best execution time. Given any SQL query, is basically impossible to anybody to pretend it knows the execution order.” I would like to hear your reply on this post soon :). Reply December 17, 2014 Chandrasekhar Raparthi Dear Andy, SQL has pre defined order of execution which Engine follows. As per my knowledge, Engine does not change the order of execution according to the query. If possible, could you please share the links of the community posts which you have read. Once again Thank you very much for showing interest on SQLVersity. ALL THE BEST Reply Leave a Reply Cancel reply Your email address will not be published. Required fields are marked *Comment Name * Email * Website Notify me of follow-up comments by email. Notify me of new posts by email. This site uses Akismet to reduce spam. Learn how your comment data is processed.