Reference and reprint http://www.cnblogs.com/bhtfg538/archive/2008/11/25/1341016.html
First:
(8) SELECT (9) DISTINCT (one) <TOP_specification> <select_list>
(1) from <left_table>
(3) <join_type> join <right_table>
(2) on <join_codition>
(4) WHERE <where_condition>
(5) GROUP by <group_by_list>
(6) with {CUBE | ROLLUP}
(7) Having
(ten) ORDER by <order_by_list>
People familiar with SQL should be able to see the function of the above statement at a glance, basically including our General query table of the wording,SQL is different from other programming languages the most obvious feature is his code shun training. In most languages, code is processed in the order of encoding, but in the SQL language, the first processed clause is the FROM clause, although the SELECT statement first appears, but is almost always the last one to process.
Logically, each step produces a virtual table that is used as input to the next step.
Theoretical knowledge of SQL logical query