Nulls Indicate Absence of Value【每日一译】--20121126

来源:互联网 发布:tensorflow cnn 教程 编辑:程序博客网 时间:2024/06/05 04:26
 A null is the absence of a value in a column of a row. Nulls indicate missing,
unknown, or inapplicable data. A null should not be used to imply any other value,
such as zero. A column allows nulls unless a NOT NULL or PRIMARY KEY integrity
constraint has been defined for the column, in which case no row can be inserted

without a value for that column.

NULL在一个行中的列是不存在值。NULL意味着没有,UNKNOWN,或者是没有可应用的数据。

一个NULL不能用于表示任何其它值,比如0.列允许空值除非此列有NOT NULL或者主键完整性约束

已经定义在此列上。在这种情况下空值是不允许被插入的。

Nulls are stored in the database if they fall between columns with data values. In these
cases they require 1 byte to store the length of the column (zero).
Trailing nulls in a row require no storage because a new row header signals that the
remaining columns in the previous row are null. For example, if the last three columns

of a table are null, no information is stored for those columns. In tables with many

columns, the columns more likely to contain nulls should be defined last to conserve
disk space.

如果空值位于在有值的数据列中那么NULL值将被存储。这种情况将要求1字节去存储列的长度(0)。

在行中以NULL结尾不要求存储因为行的头部信息保留前面行的列是空的。比如,如果一个表的最后

三列是空的,对于这些列是没有存储信息的。在一个拥有很多列的表,对于包含NULL的列应该最大可能

的定义在最后面以节省空间。

Most comparisons between nulls and other values are by definition neither true nor
false, but unknown. To identify nulls in SQL, use the IS NULL predicate. Use the SQL
function NVL to convert nulls to non-null values.
Nulls are not indexed, except when the cluster key column value is null or the index is
a bitmap index.

对于NULL与其它值的比较被定义为即不是TRUE也不是FALSE而是UNKNOW.对于确定NULL

在SQL中,可以使用IS NULL谓词。使用SQL的NVL函数去转换NULL值为非NULL值。

空值是不能被索引的,除非是聚簇主键列值为空或者索引是位图索引。


原创粉丝点击