当前位置:网站首页>E-R graph to relational model of the 2022 database of tyut Taiyuan University of Technology
E-R graph to relational model of the 2022 database of tyut Taiyuan University of Technology
2022-07-06 13:12:00 【Lala Lulu^_^】
Question 1
This kind of question is relatively simple ; Let's first solve the meanings of nouns that may appear in the problem , Then look at some examples and learn it
One 、
1、E-R Figure composition :(1) Rectangle —— Entity (2) The ellipse —— attribute (3) The diamond —— Relationship
Two 、
1、 Primary key : A primary key is an attribute or attribute group that uniquely identifies a row in a table ( This thing is easy to find , No teaching )
2、 The difference between primary key and primary code :( Generally, no distinction is made , As a thing )
A table can only have one primary key , But there can be multiple candidate indexes , When there are multiple candidate codes , You can select one as the main code , The selected candidate code is called primary key , And the main code can have multiple
3、 Foreign keys : The foreign key of one table can be associated with another table , So as to define one to many relationship or many to many relationship
4、 An attribute or a group of attributes can be both a primary key and a foreign key
5、 Relationship model : Short for R(A1,A2,~~~An),R Name the relationship ,A For the property name
3、 ... and 、 Method ( First write the rectangle , Then write diamond , After writing, confirm whether the difficulties in one-on-one appear , The primary key is written in front )
E-R How to transform a model into a relational model , There are three situations to explain , They are one-on-one , One to many and many to many .( Because there are two ways , So often the answer to this question is not unique , I will only introduce the simplest !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!)
1. One on one situation :
(1) Put all entities ( Rectangle ) And its corresponding properties ( An ellipse pointing to an entity ) In off mode R (A1,A2,~~~An) In the form of ;
(2) Then put the relationship ( The diamond ) And its corresponding entity's main code and diamond's own attributes are in relation mode R(A1,A2,~~~An) The shape of The formula is listed in turn , Among them, the relationship corresponds to R, The main code corresponds to A, Any master code can be used as the primary key of this relationship pattern
(3) difficulty : Put this difficulty in the example , Very important , Is the key to the full score of this question
2. One to many situation :
(1) Put all entities ( Rectangle ) And its corresponding properties ( An ellipse pointing to an entity ) In relational mode R (A1,A2,~~~An) In the form of ;( Same as one-on-one )
(2) Then put the relationship ( The diamond ) And its corresponding entity's main code and diamond's own attributes are in relation mode R(A1,A2,~~~An) The shape of The formula is listed in turn , Among them, the relationship corresponds to R, The main code corresponds to A, The primary key of this relational schema must specify n The main code of the end is the relational module The primary key of formula
3. Many to many situation :
(1) Put all entities ( Rectangle ) And its corresponding properties ( An ellipse pointing to an entity ) In relational mode R (A1,A2,~~~An) In the form of ;( Same as one-on-one )
(2) Then put the relationship ( The diamond ) And its corresponding entity's main code and diamond's own attributes are in relation mode R(A1,A2,~~~An) The shape of The formula is listed in turn , Among them, the relationship corresponds to R, The main code corresponds to A, The primary key of this relational schema must be n End 、m End ... The main code of is Same composition
Example :( The real question )
Explain :
边栏推荐
- Differences and application scenarios between MySQL index clock B-tree, b+tree and hash indexes
- 【话题终结者】
- [算法] 剑指offer2 golang 面试题7:数组中和为0的3个数字
- Interview Essentials: talk about the various implementations of distributed locks!
- TYUT太原理工大学2022软工导论大题汇总
- Heap sort [handwritten small root heap]
- [算法] 剑指offer2 golang 面试题3:前n个数字二进制形式中1的个数
- 阿里云微服务(四) Service Mesh综述以及实例Istio
- MySQL 三万字精华总结 + 面试100 问,吊打面试官绰绰有余(收藏系列
- [rtklib 2.4.3 B34] version update introduction I
猜你喜欢
[algorithme] swordfinger offer2 golang question d'entrevue 2: addition binaire
Fairygui bar subfamily (scroll bar, slider, progress bar)
继承和多态(下)
阿里云一面:并发场景下的底层细节 - 伪共享问题
[算法] 剑指offer2 golang 面试题13:二维子矩阵的数字之和
String类
阿里云微服务(二) 分布式服务配置中心以及Nacos的使用场景及实现介绍
Basic DOS commands
One article to get UDP and TCP high-frequency interview questions!
Fundamentals of UD decomposition of KF UD decomposition [1]
随机推荐
[算法] 劍指offer2 golang 面試題2:二進制加法
Problems and solutions of robust estimation in rtklib single point location spp
初识C语言(上)
[GNSS] robust estimation (robust estimation) principle and program implementation
[algorithm] sword finger offer2 golang interview question 6: sum of two numbers in the sorting array
2022 National Games RE1 baby_ tree
Inheritance and polymorphism (I)
TYUT太原理工大学2022数据库大题之E-R图转关系模式
Fundamentals of UD decomposition of KF UD decomposition [1]
System design learning (I) design pastebin com (or Bit.ly)
Record: newinstance() obsolete replacement method
Usage differences between isempty and isblank
TYUT太原理工大学2022数据库大题之概念模型设计
The port is occupied because the service is not shut down normally
Heap sort [handwritten small root heap]
记录:下一不小心写了个递归
[algorithm] sword finger offer2 golang interview question 1: integer division
Record: Navicat premium can't connect to MySQL for the first time
2022国赛Re1 baby_tree
165. Compare version number - string