调侃数据库3.1:关系模型-术语(简单不得了的教程)
2017-04-29 本文已影响85人
Dongle聊测试

第一章第二章已经简述完毕,现在我们将从第三章:关系模型开始着手,之所以从关系模型,前面讲过


|术语
||关系数据结构
- 关系:一个有行有列的表格
- 属性:一个表格上列的命名
- 域:就是范围
- tuple:一个行的关系
- Degree:在一个关系中属性的个数
- Cardinality:在一个关系中tuple的个数
- Relational Database:不同关系的集合

少侠莫慌,请看一下图表,再对应上面概念,是否瞬间感觉到很清晰了呢,从此肠道轻松....

||数据库中的关系
- Relation schema:由一组属性和域名定义的关系
- Relational database schema:一堆不同名称的关系模式
💖然后请记住下面:关系的一些特性

这些特性虽然繁多,但是非常容易理解,因为他们的好多特性都是从数学中的关系简化而来,埃德加考特发明关系数据库也是基于数学关系
数学中的关系(简单看下就好):

是不是很相似呢

||关系关键词
🔊请注意,下面高能预警
- Superkey: An attribute, or a set of attributes,that uniquely identifies a tuple within a relation.
- Candidate Key: Superkey (K) such that no proper subset is a superkey within the relation.
- Primary Key: Candidate key selected to identify tuples uniquely within relation .
- Alternate Keys: Candidate keys that are not selected to be primary key.
- Foreign Key: Attribute, or set of attributes,within one relation that matches candidate key of some (possibly same) relation.
累死我也,又得配图解释

图中的branchNo是Branch的主键,Registration中的propertyNo是外键,其余的请匹说明就ok了
ps:有的时候,英文确实有助于我们理解一些东西
||代表关系的数据库表
请看下面,这便是真面目,千呼万唤始出来啊

哈哈,类似的还有

是不是感觉到有些名目了呢
距离实际操作,还有一定的距离,在这之前,都要有足够的理论知识,地基是重中之重,不可小觑!!
还有,准备开将操作系统啦,感兴趣的童鞋请在留言区反馈吧