当前位置:网站首页>MySQL database design specification
MySQL database design specification
2022-08-02 07:51:00 【kk_lina】
I. Paradigm
1, 5 paradigms
- First Normal Form: atomic and cannot be split;
- Second normal form: Each data record in the data table can be uniquely identified, and non-primary key fields completely depend on the primary key.A table is an object for its own independent meaning.
- Third normal form: other non-primary key fields in the table cannot depend on other non-primary key fields, that is, non-dependent transitivity;
- Bath-Kord normal form (third normal form after optimization): the third normal form is reached, and there is only one candidate key, or each candidate key is a single attribute;
- Fourth Normal Form: Eliminate non-trivial and functionally dependent multi-value dependencies, that is, eliminate many-to-many relationships in the same table;
- Fifth Normal Form (5NF, perfect normal form): If every join dependency in a relational schema R is implied by a candidate key of R.
2. The advantages and disadvantages of the paradigm:
- Benefit: Eliminate data redundancy
- Disadvantages: reduce query efficiency, multi-table association, may be the index strategy failure
3. Denormalization
Some data may seem redundant, but they are suitable for business and need to be prioritized. At this time, de-normalization is required.
There may be a conflict between normalization and performance. You can add redundant fields to the table to reduce search time, or insert calculated columns to facilitate query.
Second, keys and related attributes
- Super key: a set of attributes that can uniquely identify a tuple;
- Candidate key: If the super key does not include redundant attributes, then this super key is the candidate key;
- Primary key: the user can choose one of the candidate keys;
- Foreign key: an attribute in one table is not the primary key of this table but the primary key of another table
- Main attribute: the main attribute involved in the candidate key
- Non-primary attribute: relative to primary attribute
Three, ER model
1. Three elements
- Entity: A data object, which can exist independently, usually a data table, represented by a rectangle;
- Attribute: the characteristics of the entity, usually a field, represented by an ellipse;
- Relation: The connection between entities, represented by a diamond.
2. Types of relationships
- One to One
- One-to-many
- Many-to-many
3. Convert the ER model diagram into a data table
- An entity is usually converted into a data table;
- A many-to-many relationship is usually also converted into a data table;
- A one-to-one relationship, or a one-to-many relationship, is usually expressed by converting it into a table's foreign key, rather than designing a new data table;
- attributes are converted into table fields.
边栏推荐
- 21 days learning challenge 】 【 sequential search
- regular expression
- CollectionUtil:一个函数式风格的集合工具
- Enterprise training and reproduction guidebook - training and reasoning of the OpenPose model based on Huawei ModelArts platform, realizing the recognition of two behaviors of climbing and climbing ov
- 获取间隔的日期列表工具类
- 查找最大的n个文件
- Splunk Filed extraction field interception
- 主流定时任务解决方案全横评
- 有关 sql中的 concat()函数问题,如何拼接
- ADS通信--倍福PLC和C#TextBox控件实现数据绑定的方法
猜你喜欢
随机推荐
逆变器绝缘检测检测功能及软件实现
责任链模式(Chain Of Responsibility)
spark读取文件夹数据
实例032:反向输出II
查看端口号占用
吃透Chisel语言.31.Chisel进阶之通信状态机(三)——Ready-Valid接口:定义、时序和Chisel中的实现
【机器学习】实验1布置:基于决策树的英雄联盟游戏胜负预测
spark 读取本地文件
sql 远程访问链接服务器
Splunk Filed Alias 字段改名
【机器学习】实验3布置:贝叶斯垃圾邮件识别
WebGPU 导入[2] - 核心概念与重要机制解读
【心电信号】基于matlab心率检测【含Matlab源码 1993期】
以训辅教,以战促学 | 新版攻防世界平台正式上线运营!
新产品立大功 伟世通第二季度营收双增
【网络】IP、子网掩码
Splunk Filed extraction field interception
分离轴定理SAT凸多边形精确碰撞检测
59:第五章:开发admin管理服务:12:MongoDB的使用场景;(非核心数据,数据量比较大的非核心数据,人脸照片等隐私的小文件;)
OC-错误提示









