MYSQL Identifying relationship 和non-Identifying relationship 区别。
来源:互联网 发布:怎样关闭136端口 xp 编辑:程序博客网 时间:2024/06/08 15:02
mysql 数据表的关系总共有三种。
第一:1对1 的关系(1:1)。
第二:1对多的关系(1:n)。
第三:多对多的关系(m:n)。
不过在设计的过程中遇到第一个和第二个中有两个选择。Identifying relationship 和non-Identifying relationship。为了以后学习记录,特此写了这份博客。
通过简单的例子 介绍Identifying relationship (识别关系) 和 non-Identifying relationship(非识别关系)区别:
一本书属于所有者,所有者可以拥有多本书。 但是,这本书也可以存在,没有所有者,所有权可以从一个所有者改变为另一个。 书与所有者之间的关系是一种非识别的关系。
然而,一本书是由作者撰写的,作者可以编写多本书。 但是,这本书需要由作者撰写 - 如果没有作者,它就不可能存在。 因此,书与作者之间的关系是一种识别关系。
识别关系:
识别关系是当子表中的行的存在取决于父表中的行时。 这可能令人困惑,因为这些日子常见的做法是为子表创建伪指令,但不能将外键作为子键的父键部分。 正式地,“正确”的做法是让外键成为小孩的主键。 但逻辑关系就是没有父母的孩子就不可能存在。
非识别关系:
父级的主键属性不能成为子级的主键属性。
阅读全文
2 0
- MYSQL Identifying relationship 和non-Identifying relationship 区别。
- Database 中 identify relationship 和 non-identify relationship的区别
- IDENTIFYING AND NON-IDENTIFYING RELATIONSHIPS
- Identifying and non-identifying relationships
- IDENTIFYING AND NON-IDENTIFYING RELATIONSHIPS in Database
- DB Concept": Identifying and Non-Identifying Relationships
- Identifying and Non-Identifying Relationships (标识和非标识关系)
- Identifying Keywords
- uml relationship
- the relationship
- coreData relationShip
- distribution relationship
- Relationship of the this pointer and (non-)const member function
- 进程和程序的区别 The relationship between process and program
- Identifying Locking Issues
- Identifying Manipulated Images
- Identifying App Installations
- Identifying the replacement drive
- Android数据存储之SharedPreferences的封装使用
- echarts基本使用
- C语言数据结构——二叉树的顺序存储结构
- 【机房重构】-泛型与datatable
- 将mysql的查询结果保存到文件中
- MYSQL Identifying relationship 和non-Identifying relationship 区别。
- MapReduce——LongWritable cannot be cast to org.apache.hadoop.io.Text 错误原因
- Java多线程-3 线程同步之synchronized
- Swift计算属性和存储属性的重要区别
- python批量下载美女图片
- 【FCN实践】02 模型迁移及初始化
- leetcode572. Subtree of Another Tree
- Ubuntu新建用户组
- 《C陷阱与缺陷》读书笔记