SQL:NULL作为ColumnName意味着什么 [英] SQL: What does NULL as ColumnName imply
问题描述
我知道AS
用于创建别名.因此,将一个长名称别名为一个短名称是有意义的.但是,我看到一个SQL
查询NULL as ColumnName
这意味着什么?
I understand that AS
is used to create an alias. Therefore, it makes sense to have one long name aliased as a shorter one. However, I am seeing a SQL
query NULL as ColumnName
What does this imply?
SELECT *, NULL as aColumn
推荐答案
别名可以以多种方式使用,而不仅仅是缩短长列名称.
Aliasing can be used in a number of ways, not just to shorten a long column name.
在这种情况下,您的示例意味着您返回的列始终包含NULL
,并且其别名/列名称为aColumn
.
In this case, your example means you're returning a column that always contains NULL
, and it's alias/column name is aColumn
.
在使用计算值(例如Column1 + Column2 AS Column3
)时也可以使用别名.
Aliasing can also be used when you're using computed values, such as Column1 + Column2 AS Column3
.
这篇关于SQL:NULL作为ColumnName意味着什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!