当前位置:网站首页>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 :
边栏推荐
- 系统设计学习(一)Design Pastebin.com (or Bit.ly)
- Small exercise of library management system
- TYUT太原理工大学2022软工导论大题汇总
- 167. Sum of two numbers II - input ordered array - Double pointers
- 初识C语言(上)
- [algorithm] sword finger offer2 golang interview question 7: 3 numbers with 0 in the array
- One article to get UDP and TCP high-frequency interview questions!
- [算法] 剑指offer2 golang 面试题6:排序数组中的两个数字之和
- 记录:newInstance()过时的代替方法
- String类
猜你喜欢
[Chongqing Guangdong education] Shandong University College Physics reference materials
Wechat applet development experience
继承和多态(下)
Alibaba cloud side: underlying details in concurrent scenarios - pseudo sharing
TYUT太原理工大学2022数据库大题之E-R图转关系模式
Abstract classes and interfaces
一文搞定 UDP 和 TCP 高频面试题!
Fgui project packaging and Publishing & importing unity & the way to display the UI
《软件测试》习题答案:第一章
Novatel board oem617d configuration step record
随机推荐
Record: newinstance() obsolete replacement method
TYUT太原理工大学2022数据库考试题型大纲
阿里云一面:并发场景下的底层细节 - 伪共享问题
Basic DOS commands
[算法] 剑指offer2 golang 面试题1:整数除法
Dark chain lock (lca+ difference on tree)
Introduction pointer notes
记录:newInstance()过时的代替方法
Role movement in the first person perspective
On March 15, the official version of go 1.18 was released to learn about the latest features and usage
最短Hamilton路径 (状压DP)
Record: solution of 404 error of servlet accessing database in dynamic web project
阿里云微服务(三)Sentinel开源流控熔断降级组件
162. Find peak - binary search
Iterable、Collection、List 的常见方法签名以及含义
十分鐘徹底掌握緩存擊穿、緩存穿透、緩存雪崩
How do architects draw system architecture blueprints?
堆排序【手写小根堆】
记录:初次cmd启动MySQL拒接访问之解决
[rtklib] preliminary practice of using robust adaptive Kalman filter under RTK