当前位置:网站首页>Er and eer models
Er and eer models
2022-04-23 02:57:00 【Senior agent of Sarkozy】
The idea of this paper mainly comes from Luo Hao jackfrued The teacher's online class
For my study reference only , Not used for other purposes !
Readers are also advised to learn through the teacher's course .
Introduce
Why would there be ER Map and EER Existence of graph ?
** Really do the project 、 When designing a database ,** It's not that simple , For example, many users can't see 、 But for convenience DBA Fields created using . Such as id, There are usually two Date Field ( A indicates when the record was created , Two indicates the last update time of this record ), And reserve a VARCHAR / json Field ; There are other considerations ( such as auto-increment Constraints are not commonly used in development , Use more algorithms, such as distributed ID generating algorithm ( Such as SnowFlake……) Of course, this is not important for the course ) It's impossible to write as soon as you come up SQL Of the statement , You need to design the structure of the table and the relationship between the tables first .
ER Model
ER chart (Entity Relationship, Entity relations ) So there comes . Here is a ER An example of a graph , The rectangular box represents : surface ( That's entity ), The oval box represents : Fields in the table ( Properties of entities ), The diamond box represents : Relationship , The multiplicity of the relationship is indicated on the connecting line .

Compared with a large section of SQL Create table statement , As long as you can understand ER chart , The structure of the table 、 The relationship is clear at a glance .
EER Model
Comparison ER The model has more generalization levels 、 Aggregation hierarchy 、 Concepts such as weak entities .
Generalization hierarchy
Include generalization and specialization ( Generalization and specialization )、 Parent class (superclass) And subclasses (subclass) The concept of .
Subclass parent class Just like that. Java Inheritance , If animals are the parent , cat 、 Dogs are a subclass .
generalization Also called induction , Is to extract the common attributes of several classes as the parent class ;
specialized Also known as deduction , Is to add their own special attributes as subclasses on the basis of the parent class .
among , Subclasses and superclasses have two relationship attributes :mandatory and optional、disjoint and overlapping.
mandatory / optional: All attributes in the parent class must be contained in each subclass / Don't inherit all , Select partial inheritance ( Completeness limitation )
disjoint / overlapping: Whether there can be intersecting properties between several subclasses inheriting the same parent class ( Intersection restrictions )

In the figure The transportation tool is the parent class , The plane 、 train 、 Cars are a subclass . Write... In the circle D / O, Express disjoint / overlapping. There is a double solid line between the parent class and the circle , Said is mandatory Complete inheritance .
Aggregation hierarchy
Aggregation, The collection hierarchy is no longer different from the parent and child classes , But by the …… The difference in composition .

Pictured , room 、 doors and windows 、 The computer 、 The projector is an integral part of the classroom , It's not inheritance .
Weak entity
One entity is meaningful only when another entity exists . Such as parents and children , Without one side, the other side is meaningless .

Workbench And other tools support painting ER chart , Even after drawing, it can be automatically generated SQL Statement table building . Workbench The picture in is EER chart ( Extended ER chart )

stay EER Below , Click on DATABASE - FORWARD ENGINEER Forward engineering , You can select the table to generate 、 Field , Generate SQL Statement creation table .
Automatically generated SQL In the sentence , There are two sentences below the foreign key ON DELETE NO ACTION ON UPDATE NO ACTION, Meaning for : When the primary key of the foreign key reference is modified / deleted , How will the table where the foreign key is located be affected ?—— Take no action . It is suggested to remove these two sentences . If you remove , You can't just modify / Delete the primary key used by the foreign key .
similarly , stay SQL Statement page , Click on DATABASE - REVERSE ENGINEER Reverse Engineering , Can be generated according to the structure of the table EER chart .
Power Designer Modeling tools , Also support positive / Reverse Engineering , Can generate SQL dialect . Full version paid .
版权声明
本文为[Senior agent of Sarkozy]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220647385077.html
边栏推荐
- Android 高阶面试必问:全局业务和项目的架构设计与重构
- Gavl021, gavl281, AC220V to 5v200ma small volume non isolated chip scheme
- Flink learning (XI) watermark
- [wechat applet] set the bottom menu (tabbar) for the applet
- Table space capacity query and expansion of Oracle Database
- 基于多态的职工管理系统源码与一些理解
- MySQL complex query uses temporary table / with as (similar to table variable)
- Traversal of l2-006 tree (middle and later order determination binary tree & sequence traversal)
- Linux Redis——Redis 数据库缓存服务
- mysql function函数语法
猜你喜欢

Source code and some understanding of employee management system based on polymorphism

Airtrack cracking wireless network password (Dictionary running method)

LeetCode 1450 - 1453

C language 171 Number of recent palindromes

Modify the content of MySQL + PHP drop-down box

grain rain

Guangcheng cloud service can fill in a daily report regularly every day

Processes and threads

Actual combat of industrial defect detection project (IV) -- ceramic defect detection based on hrnet

Fashion MNIST dataset classification training
随机推荐
Opencv reads webcam video and saves it locally
JZ22 链表中倒数最后k个结点
Guangcheng cloud service can fill in a daily report regularly every day
Difference between relative path and absolute path (often asked in interview)
字符串去掉空格问题
Traversal of l2-006 tree (middle and later order determination binary tree & sequence traversal)
win查看端口占用 命令行
Log4j knowledge point record
Step principle of logical regression in machine learning
Linux Redis ——Redis HA Sentinel 集群搭建详解 & Redis主从部署
The usage of case when and select case when is very easy to use
Domestic lightweight Kanban scrum agile project management tool
mysql function函数语法
How to use C language to realize [guessing numbers game]
First knowledge of C language ~ branch statements
tf. keras. layers. Embedding function
C language 171 Number of recent palindromes
Gavl021, gavl281, AC220V to 5v200ma small volume non isolated chip scheme
OCR识别PDF文件
The space between the left and right of the movie ticket seats is empty and cannot be selected