编写 SQL 查询时这些子句的正确顺序是什么? [英] What is the correct order of these clauses while writing a SQL query?
本文介绍了编写 SQL 查询时这些子句的正确顺序是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
SQL Server 中有很多子句,例如SELECT
、WHERE
、GROUP BY
、ORDER BY
,拥有
There are many clauses in SQL Server such as SELECT
, WHERE
, GROUP BY
, ORDER BY
, HAVING
编写查询时这些子句的正确顺序是什么?
What is the correct order of these clauses while writing a query?
推荐答案
http://msdn.microsoft.com/en-us/library/ms189499.aspx
[ WITH <common_table_expression>]
SELECT select_list [ INTO new_table ]
[ FROM table_source ] [ WHERE search_condition ]
[ GROUP BY group_by_expression ]
[ HAVING search_condition ]
[ ORDER BY order_expression [ ASC | DESC ] ]
这篇关于编写 SQL 查询时这些子句的正确顺序是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文