开发者

What is the correct order of these clauses while writing a SQL query?

There are many clauses in SQL Server such as SELECT, 开发者_Go百科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 ] ]


SELECT
Groupby
Having
OrderBy

Or

SELECT
WHERE
OrderBy


This is just a very generic query. You will need to start reading basics of SQL first. Check the link below first -

http://www.sql-tutorial.net/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜