关于SAP Tables的外键的属性

在sap的table是属性描述中

有些sap自己的概念

这也是基于所谓的SERM(structured entity relationship management)

1.Entity

这个和通常认为的实体是一致的

通俗的说可以理解为sap tables的基本表

实体和实体之间可能有多中关系

多对多关系在逻辑上存在

但是不会直接在实体与实体的实现中存在

通常是引入relation

2.relation

简单的关系
来自二元关联

relation 体现实体之间的关系

这里又可以拆分成 : 继承 ?聚合 / 组合

引入OO的概念

继承可能对应 one to many

(当然也可以反向)

聚合
是一种较强烈的相关关系

例如
电脑

鼠标

整体
包含部分 ?但是部分可以超脱整体的life span

组合
是特殊的聚合

例如人
和 ?眼睛?

通常来说
眼睛不能离开人而单独存在

而所谓的普通关系

例如人

电脑
他们就是两个基本的实体

但是他们之间的联系


使用
电脑

关于
继承

聚合

继承仅仅是针对parent object

聚合中包含更多的object

(这也是设计模式中提倡多组合
少继承的一个特征 ?组合带来更大的延展性和方便扩展)

3.sap的serm中不存在many to many

一般是通过relation表(即中间表的形式实现了多对多)

Not that the Structured Entity Relationship Model (SERM) does not allow m:n relationships (that is, many-to-many relationships). Therefore, entity types in SERM can be arranged from left to right, from independent to dependent entity type.

鉴于这个特征
也就提出了一个数量关系的要求

从顺序上看?

Independent to dependent ?: 独立 -> 依赖

用个人的话来外键指向的表作为Independent ?(当做实体)

包含外键的表
作为关系 ?是有依赖关系的

通常来说sap的检查表通常都是Independent的

数量?A:B

A?

用来表示外键指向的表 ?被依赖的 ?(可以简单理解为实体 ?实际中不一定是实体)

有两个取值 ?

1 ?被依赖方必须存在

C ?可能存在

B ?表示数量关系

被依赖

依赖方

1 ? one to one

C ?max one

N ?at least one

CN any

简单里姐实体和关系表中的关系

实体总是1 ?!!!

?
?

Relationships? In SAP

2014年4月7日

0:21

?
?

?Relationships???

Relationships?between two entity types are defined by specifying the two entity types involved, that is, the source entity type (the existentially independent entity type) and the target entity type (the existentially dependent entity type). The relationship is oriented; from the independent entity type to the dependent entity type. Relationships have these characteristics:

●??????Category

●??????Cardinality

●??????Their business significance

The relationship?Offers?exists between the entity types?Faculty?(source entity type) and?Courses?(target entity type).

Category

A relationship category can be hierarchical, aggregating, referential, or external.

Hierarchical:

There is a hierarchical relationship category between two entity types when the following apply:

●??????The target entity type is existentially dependent on the source entity type, that is, the life span of a characteristic of the target entity type is shorter than or equal to the life span of the characteristic of the source entity type.

●??????The target entity type is generated from the source entity type, that is, the source entity type influences the characteristic values directly.

●??????The target entity type represents a semantic refinement, that is, the target entity type is a classification of the source entity type which describes the source entity type more precisely.

The key of the source entity type becomes part of the key of the target entity type. You may not change the relationship between two entities.

The relationship?Offers?with the cardinality 1:CN exists between the entity types?Faculty?(source entity type) and?Courses?(target entity type).

The source entity type?Faculty?has the attributes?Faculty number?(key attribute) and?Faculty name.

The target entity type?Courses?has the attributes?Faculty number?(key attribute),?Course number?(key attribute),?Number of the course instructor?and?Course name.

Since, with this category of relationship, the source entity identifies the associated target entity by means of a part of the key attributes, a change to a relationship would mean that the target entity would be deleted and a new target entity would be created.

?
?

Aggregating:

There is an aggregating relationship category between two entity types when the following apply:

●??????The target entity type is existentially dependent on the source entity type, that is, the life span of a characteristic of the target entity type is shorter than or equal to the life span of the characteristic of the source entity type.

●??????The target entity type is generated from the source entity type, that is, the source entity type influences the characteristic values directly.

●??????At least one other source entity type, different from the first one, is involved in the formation of the target entity type.

The keys of the source entity types become part of the canonic key of the target entity type.

The aggregating and the hierarchical relationship categories differ from one another only in the third characteristic.

?
?

Referential:

There is a referential relationship category when the following apply:

●??????The target entity type is existentially dependent on the source entity type.

●??????The source entity type determines the context of the target entity type, that is, an attribute group of the start entity type is present in the target entity type, but this does not generate the target entity type.

The key attributes of the source entity type are included in the target entity type as non-key-attributes. The relationship between two entities may not be changed.

The relationship?Teaches?with cardinality 1:CN exists between the entity types?Professor?(source entity type) and?Courses?(target entity type).

The source entity type?Professor?has the attributes?Number?(key attribute),?Name,?Address, and?Salary class.

The target entity type?Courses?has the attributes?Faculty number?(key attribute),?Course number?(key attribute),?Number of the course instructor?and?Course name.

A distinction is made between strong and weak existential dependence. Strong existential dependence requires there to be an assignment to exactly one characteristic of the source entity type for each characteristic of the target entity type. If this condition applies only to one (time-dependent) subset of the target entity type, the existential dependence is said to be weak.

Weak existential dependence can occur in aggregating and referential relationship categories but not in hierarchical relationship categories.

This results in the following situation:

Classification of relationship categories


??


?
?

?
?

strong existential dependence


weak existential dependence


generating


hierarchical

aggregating


conditional-aggregating


context


referential


conditional-referential

temporary-referential

?
?

External:

A relationship between an entity type within a data model and an entity type outside the data model is described as an ‘external‘ relationship.

Cardinality

The cardinality (n : m) describes the relationship with respect to the number of dependent entities (entities of the target entity type) and independent entities (entities of the source entity type) in the relationship.

The possible values for the left and right sides of the cardinality have the following significance:

n = 1

For each dependent entity, there is precisely one independent entity.

n = C

Dependent entities can exist that do not refer to an entity of the source entity type.

m = 1

For each entity of the source entity type, there is exactly one dependent entity.

m = C

For each entity of the source entity type, there is a maximum of one dependent entity.

m = N

For each entity of the source entity type, there is at least one dependent entity.

m = CN

For each entity of the source entity type, there are any number of dependent entities.

Not that the Structured Entity Relationship Model (SERM) does not allow m:n relationships (that is, many-to-many relationships). Therefore, entity types in SERM can be arranged from left to right, from independent to dependent entity type.

The cardinality C:x (x = 1, C, CN, N) should be used only for relationships of the category ‘referential‘. However, this cardinality is also possible for relationships of the category ‘aggregating‘.

Hierarchical relationships do?not?allow this cardinality, since all dependent entities must refer to an entity of the source entity type.

?
?

From <http://help.sap.com/saphelp_em70/helpdata/en/22/bd17a8460a11d188fe0000e8323d3a/content.htm>

?
?

时间: 2024-11-07 09:31:24

关于SAP Tables的外键的属性的相关文章

MySQL无法创建外键、查询外键的属性

MySQL存储引擎--MyISAM与InnoDB区别 - 上善若水,水善利万物而不争. - CSDN博客  http://blog.csdn.net/xifeijian/article/details/20316775 MyISAM 和InnoDB 讲解 InnoDB和MyISAM是许多人在使用MySQL时最常用的两个表类型,这两个表类型各有优劣,视具体应用而定.基本的差别为:MyISAM类型不支持事务处理等高级处理,而InnoDB类型支持.MyISAM类型的表强调的是性能,其执行数度比Inno

mysql 设置外键 四大属性 CASCADE SET NULL NO ACTION RESTRICT 理解

CASCADE:主表delete.update的时候,从表会delete.update掉关联记录: SET NULL:主表delete.update的时候,从表会将关联记录的外键字段所在列设为null,注意在设计从表时外键不能设为not null: NO ACTION:先检查外键 在从表中是否有关联数据 有则不运行删除 (可以先删除从表的): RESTRICT:同 NO ACTION: 原文地址:https://www.cnblogs.com/G921123/p/10249775.html

Hibernate_8_Person和IdCard实例_一对一关系:基于外键

1)建立Person类: public class Person { private Integer id; private String name; private IdCard IdCard; public String getName() { return name; } public void setName(String name) { this.name = name; } public Integer getId() { return id; } public void setId

mysql 1215错误——外键建立失败

在Mysql中创建数据表时,经常会遇到问题而失败,其中建立外键有很多细节需要我们去留意,主要有以下几种常见原因. 1.  两个字段的类型或者大小不严格匹配.例如,如果一个是int(10),那么外键也必须设置成int(10),而不是int(11),也不能是tinyint.另外,你还必须确定两个字段是否都为signed或者unsigned,这两字段必须严格地一致匹配. 2. 设置外键的字段没有建立起索引,或者不是一个primary key(主键).一般,需要建立外键的数据表称为子表,而相关联的数据表

django 外键操作

下面定义两个模型,一个主表,一个字表. 举例说明: 如何通过主表对象找到对应的子表对象? 如何通过子表对象找到对应的主表对象? class Person(models.Model); name = models.CharField('作者姓名', max_length=10) age = models.IntegerField('作者年龄') class Book(models.Model): person = models.ForeignKey(Person,related_name='per

DRF4级联与外键字段

断关联表关系 外键字段属性 多表操作 断关联表关系 ''' 1.不会影响连表查询操作效率 2.会提升连表增删改操作效率 3.易于后期数据库表的重构 4.缺点:数据库本身设有连表检测,容易出现脏数据,需要通过严格的逻辑避免脏数据的参数(必要的时候管理脏数据) 举例: A依赖B,先插入A记录,该记录对应的B记录没产生,在没有关联的情况下,该操作可以实现,但是数据就是脏数据.接着再将B数据添加,脏数据就得到处理了.反过来先操作B后操作A,更满足逻辑思维,一样可以执行.通过逻辑将AB表进行 连表查询,不

SQL Server 如何添加删除外键、主键,以及更新自增属性

1.添加删除主键和外键 例如: -----删除主键约束DECLARE @NAME SYSNAMEDECLARE @TB_NAME SYSNAMESET @TB_NAME = 'Date'SELECT TOP 1  @NAME=NAME FROM SYS.OBJECTS WITH(NOLOCK)WHERE TYPE_DESC ='PRIMARY_KEY_CONSTRAINT' AND PARENT_OBJECT_ID = (    SELECT OBJECT_ID    FROM SYS.OBJE

mysql字符串类型、列属性及外键

字符串类型 Char 和varchar 在定义char 跟varchar时,都需要设置长度. 语法: char(M); 最大长度为255 varchar(M); 最大长度为65532 不同编码长度不同 GBK最大为:32767 utf8最大为:21845 M为长度! 两者区别: Char的M是固定的,即使输入的字符长度小于M值,该字符长度也会被定义为M值: 效率更快,使用一些固定字符长度的时候可以使用,例:电话号码.身份证号码等! Varchar的M是范围性值,只要不超过M,输入的值长度为多少即

《Entity Framework 6 Recipes》中文翻译系列 (29) ------ 第五章 加载实体和导航属性之过滤预先加载的实体集合和修改外键关联

翻译的初衷以及为什么选择<Entity Framework 6 Recipes>来学习,请看本系列开篇 5-13  过滤预先加载的实体集合 问题 你想过滤预先加载的实体集合,另外,你想使用Code-First来管理数据访问 解决方案 实体框架不支持直接使用Include()时过滤关联实体集合,但我们可以通过创建一个匿名类型来完成同样的事情,匿名类型包含实体和要过滤的关联实体集合. 假设你有如图5-28所示的概念模型 图5-28 一个包含movies(电影)和它的categories(目录)的模