当前位置:网站首页>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 :

边栏推荐
- MySQL backup -- common errors in xtrabackup backup
- On March 15, the official version of go 1.18 was released to learn about the latest features and usage
- IText 7 generate PDF summary
- First acquaintance with C language (Part 2)
- Inheritance and polymorphism (I)
- Design a key value cache to save the results of the most recent Web server queries
- Usage differences between isempty and isblank
- The port is occupied because the service is not shut down normally
- Small exercise of library management system
- 2022国赛Re1 baby_tree
猜你喜欢

《软件测试》习题答案:第一章

编辑距离(多源BFS)

堆排序【手写小根堆】

Inheritance and polymorphism (I)

Basic DOS commands

【无标题】
![[untitled]](/img/b1/9a2bebebb24132a405fc4e7d854e51.png)
[untitled]
![[algorithm] sword finger offer2 golang interview question 2: binary addition](/img/c2/6f6c3bd4d70252ba73addad6a3a9c1.png)
[algorithm] sword finger offer2 golang interview question 2: binary addition

Problems and solutions of robust estimation in rtklib single point location spp

MySQL 30000 word essence summary + 100 interview questions, hanging the interviewer is more than enough (Collection Series
随机推荐
[算法] 剑指offer2 golang 面试题6:排序数组中的两个数字之和
一文搞定 UDP 和 TCP 高频面试题!
Usage differences between isempty and isblank
Design a key value cache to save the results of the most recent Web server queries
Branch and loop statements
[rtklib] preliminary practice of using robust adaptive Kalman filter under RTK
XV Function definition and call
【无标题】
[算法] 剑指offer2 golang 面试题2:二进制加法
TYUT太原理工大学2022数据库大题之数据库操作
如何保障 MySQL 和 Redis 的数据一致性?
WSL common commands
Error: sorting and subscript out of bounds
[算法] 剑指offer2 golang 面试题8:和大于或等于k的最短子数组
Detailed explanation of balanced binary tree is easy to understand
阿里云微服务(二) 分布式服务配置中心以及Nacos的使用场景及实现介绍
抽象类和接口
图书管理系统小练习
【话题终结者】
【快趁你舍友打游戏,来看道题吧】