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)]