dbms 面向对象模型
As we described in the tutorial Database models, Entity-relationship model is a model used for design and representation of relationships between data.
正如我们在数据库模型教程中描述的那样,实体关系模型是用于设计和表示数据之间的关系的模型。
The main data objects are termed as Entities, with their details defined as attributes, some of these attributes are important and are used to identity the entity, and different entities are related using relationships.
主要数据对象称为实体,其详细信息定义为属性,其中一些属性很重要,用于标识实体,而不同的实体使用关系进行关联。
In short, to understand about the ER Model, we must understand about:
简而言之,要了解ER模型,我们必须了解:
Entity and Entity Set
实体和实体集
What are Attributes? And Types of Attributes.
什么是属性? 和属性类型。
Keys
按键
Relationships
人际关系
Let's take an example to explain everything. For a School Management Software, we will have to store Student information, Teacher information, Classes, Subjects taught in each class etc.
让我们以一个例子来解释一切。 对于学校管理软件 ,我们将必须存储学生信息, 教师信息, 班级 ,每个班级中教的科目等。
ER模型:实体和实体集 (ER Model: Entity and Entity Set)
Considering the above example, Student is an entity, Teacher is an entity, similarly, Class, Subject etc are also entities.
考虑以上示例, Student是一个实体, Teacher是一个实体,类似地, Class , Subject等也是实体。
An Entity is generally a real-world object which has characteristics and holds relationships in a DBMS.
实体通常是一个现实世界的对象,它具有特征并在DBMS中保持关系。
If a Student is an Entity, then the complete dataset of all the students will be the Entity Set
如果学生是实体,则所有学生的完整数据集将是实体集
ER模型:属性 (ER Model: Attributes)
If a Student is an Entity, then student's roll no., student's name, student's age, student's gender etc will be its attributes.
如果学生是实体,则学生名册编号。 ,学生的姓名 ,学生的年龄 ,学生的性别等是其属性。
An attribute can be of many types, here are different types of attributes defined in ER database model:
属性可以有多种类型,这是ER数据库模型中定义的不同类型的属性:
Simple attribute: The attributes with values that are atomic and cannot be broken down further are simple attributes. For example, student's age.
简单属性:具有原子值且无法进一步细分的值的属性是简单属性。 例如,学生的年龄 。
Composite attribute: A composite attribute is made up of more than one simple attribute. For example, student's address will contain, house no., street name, pincode etc.
复合属性:复合属性由多个简单属性组成。 例如,学生的地址将包含房屋编号。 , 街道名称 , 密码等。
Derived attribute: These are the attributes which are not present in the whole database management system, but are derived using other attributes. For example, average age of students in a class.
派生属性:这些属性在整个数据库管理系统中不存在,而是使用其他属性派生的。 例如, 班上学生的平均年龄 。
Single-valued attribute: As the name suggests, they have a single value.
单值属性:顾名思义,它们具有单个值。
Multi-valued attribute: And, they can have multiple values.
多值属性:而且,它们可以具有多个值。
ER模型:键 (ER Model: Keys)
If the attribute roll no. can uniquely identify a student entity, amongst all the students, then the attribute roll no. will be said to be a key.
如果属性滚动号。 可以在所有学生中唯一地标识一个学生实体,则属性卷编号。 将被认为是关键。
Following are the types of Keys:
以下是密钥的类型:
Super Key
超级钥匙
Candidate Key
候选键
Primary Key
首要的关键
We have covered Keys in details here in Database Keys tutorial.
ER模型:关系 (ER Model: Relationships)
When an Entity is related to another Entity, they are said to have a relationship. For example, A Class Entity is related to Student entity, becasue students study in classes, hence this is a relationship.
当一个实体与另一个实体相关时,它们被称为有关系。 例如,一个班级实体与学生实体相关,因为学生在课堂上学习,因此这是一种关系。
Depending upon the number of entities involved, a degree is assigned to relationships.
根据所涉及实体的数量,将度分配给关系。
For example, if 2 entities are involved, it is said to be Binary relationship, if 3 entities are involved, it is said to be Ternary relationship, and so on.
例如,如果涉及2个实体,则称为二元关系 ;如果涉及3个实体,则称为三元关系,依此类推。
In the next tutorial, we will learn how to create ER diagrams and design databases using ER diagrams.
在下一个教程中,我们将学习如何创建ER图和使用ER图设计数据库。
翻译自: https://www.studytonight.com/dbms/er-model-concepts.php
dbms 面向对象模型