当前位置:网站首页>TYUT太原理工大学2022数据库大题之E-R图转关系模式
TYUT太原理工大学2022数据库大题之E-R图转关系模式
2022-07-06 09:19:00 【啦啦噜噜^_^】
题型一
这类题较简单;我们还是先了解题中可能出现得各名词含义,然后看几道例题把它学会
一、
1、E-R图构成:(1)长方形——实体(2) 椭圆——属性(3)菱形——关系
二、
1、主键:主键就是能够唯一标识表中某一行的属性或属性组(这个东西很好找,不教啦)
2、主键和主码的区别:(一般不做区分,当成一种东西)
一个表只能有一个主键,但可以有多个候选索引,当有多个候选码时,可以选定一个作为主码,选定的候选码称主键,而主码可以有多个
3、外键:通过一个表的外键可以关联到另一个表,从而定义出一对多关系或多对多关系
4、一个属性或者一组属性可以既是主键又是外键
5、关系模式:简记为R(A1,A2,~~~An),R为关系名,A为属性名
三、方法(先写长方形,再写菱形,写完后确认一对一中的难点是否出现,主键写在前面)
E-R模型如何转换成关系模型,这里分成三种情况进行讲解,分别是一对一,一对多和多对多。(因为有两种方法,所以往往这种题答案不唯一,我这里只介绍最简单的!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!)
1.一对一的情况:
(1)将所有实体(即长方形)及其相对应的属性(指向实体的椭圆)以关模式 R (A1,A2,~~~An)的形式依次列出;
(2)再将关系(菱形)及其对应实体的主码和菱形本身属性以关系模式R(A1,A2,~~~An)的形 式依次列出,其中关系对应R,主码对应A,任意主码都可以作为此关系模式的主键
(3)难点:此难点放到例题中讲,很重要,是该题满分的关键
2.一对多的情况:
(1)将所有实体(即长方形)及其相对应的属性(指向实体的椭圆)以关系模式 R (A1,A2,~~~An)的形式依次列出;(与一对一相同)
(2)再将关系(菱形)及其对应实体的主码和菱形本身属性以关系模式R(A1,A2,~~~An)的形 式依次列出,其中关系对应R,主码对应A,此关系模式的主键必须指定n端的主码为关系模 式的主键
3.多对多的情况:
(1)将所有实体(即长方形)及其相对应的属性(指向实体的椭圆)以关系模式 R (A1,A2,~~~An)的形式依次列出;(与一对一相同)
(2)再将关系(菱形)及其对应实体的主码和菱形本身属性以关系模式R(A1,A2,~~~An)的形 式依次列出,其中关系对应R,主码对应A,此关系模式的主键必须由n端、m端...的主码共 同构成
例题:(真题)
解:

边栏推荐
猜你喜欢

10 minutes pour maîtriser complètement la rupture du cache, la pénétration du cache, l'avalanche du cache
![[algorithm] sword finger offer2 golang interview question 3: the number of 1 in the binary form of the first n numbers](/img/64/0f352232359c7d44f12b20a64c7bb4.png)
[algorithm] sword finger offer2 golang interview question 3: the number of 1 in the binary form of the first n numbers

【干货】提升RTK模糊度固定率的建议之周跳探测
![[algorithm] sword finger offer2 golang interview question 9: subarray with product less than k](/img/65/fc3fb5a217a3b44f506b695af53e2c.png)
[algorithm] sword finger offer2 golang interview question 9: subarray with product less than k

抽象类和接口

架构师怎样绘制系统架构蓝图?

服务未正常关闭导致端口被占用

Basic DOS commands

系统设计学习(三)Design Amazon‘s sales rank by category feature
![[algorithm] sword finger offer2 golang interview question 8: the shortest subarray with a sum greater than or equal to K](/img/8c/1b6ba3b1830ad28176190170c98628.png)
[algorithm] sword finger offer2 golang interview question 8: the shortest subarray with a sum greater than or equal to K
随机推荐
Devops' future: six trends in 2022 and beyond
What are the advantages of using SQL in Excel VBA
RTKLIB: demo5 b34f. 1 vs b33
记录:newInstance()过时的代替方法
Employment of cashier [differential constraint]
Fundamentals of UD decomposition of KF UD decomposition [1]
2022 National Games RE1 baby_ tree
[algorithm] sword finger offer2 golang interview question 5: maximum product of word length
如何保障 MySQL 和 Redis 的数据一致性?
[GNSS data processing] Helmert variance component estimation analysis and code implementation
阿里云微服务(一)服务注册中心Nacos以及REST Template和Feign Client
Usage differences between isempty and isblank
[算法] 劍指offer2 golang 面試題2:二進制加法
系统设计学习(二)Design a key-value cache to save the results of the most recent web server queries
Shortest Hamilton path (pressure DP)
Interview Essentials: talk about the various implementations of distributed locks!
Fairygui bar subfamily (scroll bar, slider, progress bar)
The earth revolves around the sun
Tyut Taiyuan University of technology 2022 introduction to software engineering examination question outline
[算法] 剑指offer2 golang 面试题3:前n个数字二进制形式中1的个数