当前位置:网站首页>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 :
边栏推荐
- 阿里云微服务(三)Sentinel开源流控熔断降级组件
- [算法] 剑指offer2 golang 面试题12:左右两边子数组的和相等
- TYUT太原理工大学2022数据库大题之分解关系模式
- Fairygui bar subfamily (scroll bar, slider, progress bar)
- 继承和多态(下)
- [GNSS data processing] Helmert variance component estimation analysis and code implementation
- Design a key value cache to save the results of the most recent Web server queries
- 闇の連鎖(LCA+树上差分)
- 4.30 dynamic memory allocation notes
- 十分钟彻底掌握缓存击穿、缓存穿透、缓存雪崩
猜你喜欢
[算法] 剑指offer2 golang 面试题3:前n个数字二进制形式中1的个数
图书管理系统小练习
Experience summary of autumn recruitment of state-owned enterprises
Design a key value cache to save the results of the most recent Web server queries
堆排序【手写小根堆】
服务未正常关闭导致端口被占用
MySQL 30000 word essence summary + 100 interview questions, hanging the interviewer is more than enough (Collection Series
TYUT太原理工大学2022“mao gai”必背
Dark chain lock (lca+ difference on tree)
继承和多态(下)
随机推荐
一文搞定 UDP 和 TCP 高频面试题!
121 distributed interview questions and answers
[算法] 剑指offer2 golang 面试题6:排序数组中的两个数字之和
XV Function definition and call
Error: symbol not found
TYUT太原理工大学2022数据库之关系代数小题
[Chongqing Guangdong education] Shandong University College Physics reference materials
[算法] 剑指offer2 golang 面试题10:和为k的子数组
How to reduce the shutdown time of InnoDB database?
3月15号 Go 1.18 正式版发布 了解最新特色以及使用方法
Common method signatures and meanings of Iterable, collection and list
167. Sum of two numbers II - input ordered array - Double pointers
2022 National Games RE1 baby_ tree
[算法] 剑指offer2 golang 面试题7:数组中和为0的3个数字
MySQL 30000 word essence summary + 100 interview questions, hanging the interviewer is more than enough (Collection Series
TYUT太原理工大学2022数据库大题之概念模型设计
Abstract classes and interfaces
Small exercise of library management system
[untitled]
Wechat applet development experience