帮忙翻译如下短文?译完马上结贴,谢谢

bluesea07 2006-05-14 05:00:56
Analysis
This statement creates the Vendors table used throughout this book. The vendor ID and vendor name columns are both required, and are, therefore, specified as NOT NULL. The five remaining columns all allow NULL values, and so NOT NULL is not specified. NULL is the default setting, so if NOT NULL is not specified NULL is assumed.
Specifying NULL :Most DBMSs treat the absence of NOT NULL to mean NULL. However, not all do. DB2 requires the keyword NULL and will generate an error if it is not specified. Refer to your DBMS documentation for complete syntax information.
Primary Keys and NULL Values :Back in Lesson 1, you learned that primary keys are columns whose values uniquely identify every row in a table. Only columns that do not allow NULL values can be used in primary keys. Columns that allow no value at all cannot be used as unique identifiers.
Understanding NULL :Don't confuse NULL values with empty strings. A NULL value is the lack of a value; it is not an empty string. If you were to specify '' (two single quotes with nothing in between them), that would be allowed in a NOT NULL column. An empty string is a valid value; it is not no value. NULL values are specified with the keyword NULL, not with an empty string.
Specifying Default Values
SQL enables you to specify default values to be used if no value is specified when a row is inserted. Default values are specified using the DEFAULT keyword in the column definitions in the CREATE TABLE statement.
Look at the following example:
...全文
91 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
hjw01592 2006-05-15
  • 打赏
  • 举报
回复
还是偶来吧:

分析
这段代码创建了卖主表在这本书中贯穿使用。卖主的序号和名称列都是需要的,所以要指定他们是非空的列。剩下的5列是允许为空的,所以没有指定他们为非空列。NULL值是默认设定的,所以如果是非空列就假定不指定为NULL。
指定NULL:大多数的数据库管理系统把不是非空值的列视为NULL。但不是所有的数据管理系统都是这样。DB2需要关键字NULL而且如果没有指定,数据库将产生一个错误。查阅你的数据库管理系统文档来得到完整的语法信息。
主键和NULL值:在第一章中,你已经学习到主键是表中用来唯一标识的每一行的。只有那些非空的列才能用来做主键。那些允许为空的列是不能用来做唯一标识的。
理解NULL:不要把NULL值和空字符串搞混淆了。NULL表示的是一个值的缺乏,它不是一个空字符串。如果你要指定“”(在不包含任何内容的两个单一的引用中),那将允许放在一个非空的列中。一个空字符串是一个有效的值,而不代表没有值。NULL被指定为关键字NULL,而不是一个空字符串。

指定默认值
当新的列被插入没有指定值时,SQL允许你指定一个默认值。在创建表的代码时在定义的列中使用的默认关键字可用做默认值。
我们来看看下面的例子:
bluesea07 2006-05-15
  • 打赏
  • 举报
回复
多谢多谢
itblog 2006-05-15
  • 打赏
  • 举报
回复
Analysis
分析
This statement creates the Vendors table used throughout this book. The vendor ID and vendor name columns are both required, and are, therefore, specified as NOT NULL. The five remaining columns all allow NULL values, and so NOT NULL is not specified. NULL is the default setting, so if NOT NULL is not specified NULL is assumed.
通过本书给的语句创建一个表vendors,表vendor的ID和name是必须的,因为指定为不允许空,五个保留的列允许空值,所以not null不用指定,空值是系统默认设置,如果不指定not null自动分配为空.
Specifying NULL :Most DBMSs treat the absence of NOT NULL to mean NULL. However, not all do. DB2 requires the keyword NULL and will generate an error if it is not specified. Refer to your DBMS documentation for complete syntax information.
指定空值:大多数DBMS系统如果不指定not null而默认为空,但在DB2数据库中,如果不指定空值,将会产生一个错误~关于完全的语法数据参照你的数据库管理系统文件。
Primary Keys and NULL Values :Back in Lesson 1, you learned that primary keys are columns whose values uniquely identify every row in a table. Only columns that do not allow NULL values can be used in primary keys. Columns that allow no value at all cannot be used as unique identifiers.
主键和空值:回到第一课,你可以了解到这些值在表里都是唯一的,仅仅不允许为空的列才可以用作主键,不允许为空的列不能用作唯一标识.
Understanding NULL :Don't confuse NULL values with empty strings. A NULL value is the lack of a value; it is not an empty string. If you were to specify '' (two single quotes with nothing in between them), that would be allowed in a NOT NULL column. An empty string is a valid value; it is not no value. NULL values are specified with the keyword NULL, not with an empty string.
理解Null:不要把Null混为空字符串,一个空值是没有值,不代表空字符串,如果你指定''(两个单引号中间不要有任何东西),这在not null指定的列中是允许的,一个空字符串是一个不效值,如果是没有值,应该指定为null,而不应该指定为空字符串.
Specifying Default Values
指定默认值
SQL enables you to specify default values to be used if no value is specified when a row is inserted. Default values are specified using the DEFAULT keyword in the column definitions in the CREATE TABLE statement.
Look at the following example:
当插入记录的时候,如果没有值,可以使用SQL指定一个默认值,默认值是在创建表定义列的语句的时候,使用default关键字后面指定的, 看下面这个例子.

34,587

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧