当前位置:网站首页>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.
边栏推荐
- MQ带来的一些问题、及解决方案
- 【机器学习】实验4布置:AAAI会议论文聚类分析
- 雷达人体存在感应器方案,智能物联网感知技术,实时感应人体存在
- 实例031:字母识词
- 2020美亚团队赛复盘
- Ask a question, my Flinkcdc has run through, I can monitor the binlog of msql, and I can also send kafk
- 【论文精读】Geometric Structure Preserving Warp for Natural Image Stitching
- 2022.07.31(LC_6132_使数组中所有元素都等于零)
- 【故障诊断分析】基于matlab FFT轴承故障诊断【含Matlab源码 2001期】
- 神经元网络
猜你喜欢
随机推荐
CSRF-跨站请求伪造-相关知识
【杂】pip换国内源教程及国内源地址
实例029:反向输出
MySQL报错1055解决办法:[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains
条件构造器~wapper
OC-NSNumber和NSValue一般用来装箱拆箱
吃透Chisel语言.30.Chisel进阶之通信状态机(二)——FSMD:以Popcount为例
Facebook社媒营销的5大技巧,迅速提高独立站转化率!
2022夏暑假每日一题(六)
OC-NSArray
SQL server 2014 怎么一次性导出多个查询结果?
Splunk Filed Alias field name
企业实训复现指导手册——基于华为ModelArts平台的OpenPose模型的训练和推理、基于关键点数据实现对攀爬和翻越护栏两种行为的识别、并完成在图片中只标注发生行为的人
【机器学习】实验3布置:贝叶斯垃圾邮件识别
View zombie processes
吃透Chisel语言.31.Chisel进阶之通信状态机(三)——Ready-Valid接口:定义、时序和Chisel中的实现
LeetCode 283. Shifting Zeros (Simple, Array)
牛客编程题中——需要处理输入较大数的题目
神经元网络
【CNN回归预测】基于matlab卷积神经网络CNN数据回归预测【含Matlab源码 2003期】