当前位置:网站首页>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.
边栏推荐
猜你喜欢

雷达人体存在感应器方案,智能物联网感知技术,实时感应人体存在

Mysql报错2003 解决办法 Can‘t connect to MySQL server on ‘localhost‘ (10061)

OC-错误提示

自然语言处理 文本预处理(下)(张量表示、文本数据分析、文本特征处理等)

吃透Chisel语言.30.Chisel进阶之通信状态机(二)——FSMD:以Popcount为例

实例029:反向输出

Splunk Field Caculated 计算字段

【请教】SQL语句按列1去重来计算列2之和
![带手续费买卖股票的最大利益[找DP的状态定义到底缺什么?]](/img/14/cd6ed7452230571db2e027f61dbdba.png)
带手续费买卖股票的最大利益[找DP的状态定义到底缺什么?]

mysql操作入门(四)-----数据排序(升序、降序、多字段排序)
随机推荐
【机器学习】实验1布置:基于决策树的英雄联盟游戏胜负预测
请教一下,Flink SQL ,JDBC sink 入 mysql 库,想要搞一个自增主键,要怎么写
MySQL-FlinkCDC-Hudi实时入湖
PWA 踩坑 - 第一次加载页面后无法获取CacheStorage某些资源
View port number occupancy
spark读取文件夹数据
跨阻放大器
OC-NSArray
实例026:递归求阶乘
分离轴定理SAT凸多边形精确碰撞检测
【请教】SQL语句按列1去重来计算列2之和
FormData upload binary file, object, object array
责任链模式(Chain Of Responsibility)
【故障诊断分析】基于matlab FFT轴承故障诊断【含Matlab源码 2001期】
倍福使用AdsRemote组件实现和C#的ADS通讯
正则表达式的理解学习
OC-NSArray
Splunk Filed extraction 字段截取
OC-Category
LeetCode 283. Shifting Zeros (Simple, Array)