【Database System Concept 7th】Chapter 2读书笔记

Chapter 2 Introduction to the Relation Model

  • 2.1 Structure of Relational Databases
  • 2.2 Database Schema
  • 2.3 Keys
  • 2.4 2.5 2.6

这一章主要讲的是Relation Model(关系模型)的一些相关概念,并举了很多相关例子说明。下面举例子中提到的relation参考Database System Concept 7th相关章节定义(会给出书中的Figure编号)。

2.1 Structure of Relational Databases

这一节主要讲了关系型数据库的基本结构以及一些基本概念。
关系型数据库由一堆table组成(就是一堆表格)。每一种table确定了一种relation,具体的table(带数据的)在这里称为relation instance(关系实体),table中的每一行称为tuple,每一列的表名称为attribute
其中,每一个attribute都有自己的domain(即值域)。在关系型数据库中,任何domain中的元素都必须是atomic的(具有原子性),即元素不可再分,举个例子就是,假设instruction这个relation中(Figure 2.1),有一个叫phone_numberattribute,这个attribute存放的是一个人所有电话号码的集合,那么这个attribute在关系型数据库中是不被允许的。

2.2 Database Schema

database schema,可以理解为数据库的结构,就是数据库中包含哪些relation
database instance,数据库实体,个人理解为某个具体数据库中某个特定时间存放的所有数据集合。
relation schema,这个好理解,就是relation的结构,其实就是表名+表项(后面还会标识key)。

2.3 Keys

这一节主要讲了一些key的概念。
candidate key:就是可以用于区分relation中不同tuple的最小attribute集合,不能含有冗余的attributerelation自身的性质
super key:可以理解为candidate key的超集,可以含有冗余attributerelation自身的性质
primary key:用户为某个relation所指定的candidate key(因为一个relation可能含有多个candidate key
foreign key:涉及两个relationr1r2),也是用户指定的,限制了r1中的某个attribute集合A的值必须在r2中对应的attribute集合A存在,同时,Ar2primary keyr1也被称为referencing relationr2也被称为referenced relation
referential integrity constraint:这个限制和foreign-key constraint类似,只不过A没有被要求一定为r2primary key

2.4 2.5 2.6

这三节就不在这里赘述了,其中Relational Algebra还是比较重要滴,不过都不难看懂,过一遍就是了!

你可能感兴趣的:(CMU,15-445,数据库,database)