视图索引和数据完整性课件.ppt

  1. 1、本文档共76页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
An Introduction to Database Systems;An Introduction to Database Systems;An Introduction to Database Systems;An Introduction to Database Systems;An Introduction to Database Systems;An Introduction to Database Systems;An Introduction to Database Systems;An Introduction to Database Systems;An Introduction to Database Systems;An Introduction to Database Systems;An Introduction to Database Systems;An Introduction to Database Systems;An Introduction to Database Systems;An Introduction to Database Systems;An Introduction to Database Systems;An Introduction to Database Systems;An Introduction to Database Systems;An Introduction to Database Systems;An Introduction to Database Systems;An Introduction to Database Systems;An Introduction to Database Systems;An Introduction to Database Systems;An Introduction to Database Systems;An Introduction to Database Systems;An Introduction to Database Systems;An Introduction to Database Systems;An Introduction to Database Systems;An Introduction to Database Systems;1.实体完整性 实体完整性也可称为表的完整性,是指表中必须有一个主关键字,用来惟一地标识表中的每一行,且不允许为空值(NULL)。实体完整性强制表的标识符列或主键的完整性(通过索引、UNIQUE约束、PRIMARY KEY约束或IDENTITY属性实现)。 2. 域完整性 域完整性也可称为列的完整性,是指给定列的输入有效性,用于限制向表中输入的值的范围。强制域有效性的方法有:限制类型(通过类型)、格式(通过CHECK约束和规则)或可能值的范围(通过FOREIGN KEY约束、CHECK约束、DEFAULT定义、NOT NULL定义和规则)。;引用完整性 引用完整性也称参照完整性,在输入或删除记录时,引用完整性保持表之间已定义的关系。在SQL Server2000中,引用完整性基于外键与主键之间或外键与唯一键之间的关系(通过FOREIGN KEY和CHECK约束)。 引用完整性确保键值在所有表中一致。这样的一致性要求不能引用不存在的值,如果键值更改了,那么在整个数据库中,对该键值的所有引用要进行一致的更改 。; ;An Introduction to Database Systems;An Introduction to Database Systems;图 设计表;④单击【新建】按钮,在列名下选择【系部名称】,再在【创建UNIQUE(U)】复选框上打√,单击【约束】。 ⑤单击【关闭】按钮,在设计窗口单击【保存】按钮后,关闭设计表对话框即可。;方法二、在SQL Server 2000中,也可用ALTER TABLE命令来创建一个UNIQUE约束。其语法为: ALTER TABLE table_name ADD [CONSTAINT Constraint_name] UNIQUE {(Column[,…n]) 在查询分析器中通过执行以下语句可以实现【例7-2】的任务。 USE XSCJ GO ALTER TABLE 系部表 ADD CONSTRAINT UNI_stu_addr UNIQUE (系部名称) GO ;CHECK 约束 CHECK约束通过限制输入到列中的值来强制域的完整性。这与FOREIGN KEY约束控制列中数值相似。区别在于它们如

文档评论(0)

2017meng + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档