- Learn T-SQL Querying
- Pedro Lopes Pam Lahoud
- 181字
- 2021-06-24 14:38:08
SELECT
The SELECT clause defines the columns and expressions that will be returned in the results and is the only element that is required to form a valid T-SQL data retrieval statement. Elements in the SELECT statement can be as simple as a single constant value, or as complex as a full T-SQL sub-query, but generally it is a comma-separated list of columns from tables and views in a database.
The following query will return a single row with a single column:
SELECT 1;
In the following screenshot we can see the result:

The SELECT clause can also be used to format the results by providing column aliases or using expressions to modify the data. Aliases are created with the optional keyword AS, followed by the intended column name to be displayed in the result set:
SELECT Name AS ProductName, LEFT(ProductNumber, 2) AS ProductCode, ISNULL(color, 'No Color') AS Color [...]
Note that, in the results, any row that has a value for Color will display that value, whereas any row that has a null color will display No Color instead:

- 腦動力:C語言函數速查效率手冊
- 大數據改變世界
- 傳感器技術應用
- 大型數據庫管理系統技術、應用與實例分析:SQL Server 2005
- 基于ARM 32位高速嵌入式微控制器
- Docker High Performance(Second Edition)
- C語言寶典
- Machine Learning with Apache Spark Quick Start Guide
- Apache源代碼全景分析(第1卷):體系結構與核心模塊
- 單片機技術項目化原理與實訓
- IBM? SmartCloud? Essentials
- 實戰Windows Azure
- 運動控制系統
- Ubuntu 9 Linux應用基礎
- 服務器配置與應用(Windows Server 2008 R2)