"13" A complete SELECT statement [SELECT (Transact-SQL)]

Source: Internet
Author: User

Brief introduction:

Retrieves rows from the database and allows you to select one or more rows or columns from one or more tables in SQL Server 2012. Although the complete syntax of the SELECT statement is more complex, its main clauses can be summarized as follows:

[With <common_table_expression>]SELECTSelect_list[Into new_table][From table_source] [WHERE search_condition][GROUP by Group_by_expression][Having search_condition][ORDER by order_expression [ASC | DESC]]

You can use the UNION, EXCEPT, and INTERSECT operators between queries to merge or compare the results of individual queries into a single result set.

Grammar:

<SELECTStatement>::=      [With <common_table_expression> [,... n]]    <Query_expression>     [ORDER by {order_by_expression | column_position [ASC | DESC] }   [,... N] ]     [<for clause>]     [OPTION (<query_hint> [,... n] ) ] <Query_expression>::=     { <Query_specification> |(<Query_expression> ) }     [{UNION [ all] | EXCEPT | INTERSECT }        <Query_specification> |(<Query_expression>)[. .. n] ] <Query_specification>::= SELECT [All | DISTINCT]     [TOP (expression) [PERCENT] [With TIES] ]     <Select_list>     [Into new_table]     [From {<table_source>} [,... n] ]     [WHERE <search_condition>]     [<group by>]     [Having < search_condition >]

"13" A complete SELECT statement [SELECT (Transact-SQL)]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.