数据库是存储在名为数据库管理系统 (DBMS) 的软件中的逻辑相关数据的有组织的集合。在将数据插入系统之前,需要以模型的形式对数据库进行适当的理解。引入了许多模型,Entity-Relationship 模型就是其中之一。它是数据的图形表示,提供了数据的整体视图。这个 ER 模型有基本的构建单元,其中实体和对象是其中的一部分。
1. 实体:
实体是与其他实体不同的实时对象。实体可以使用其属性进行定义。他们是实体的一部分。实体可以用图形形式表示。相似实体的集合是一个实体集。
Example:
A computer, car, place, software
2. 对象:
一个同时包含属性和动作的实体是它的对象。它由其生命周期、名称和对象标识符定义。每个对象都有两个组件:状态和行为。
Example:
views, indices, sequences
实体和对象的区别是:
S.NO | Entity | Object |
---|---|---|
1. | Entity is a real time object that can be distinguised from other objects. | Object is an entity that has all the attributes and the actions required to be taken. |
2. | An entity contains of attributes. | An object has life span, object identifier. |
3. | Entity is a uniquely identifiable object. | An object can be identified using its identifier. |
4. | Every entity has a primary key for identification purposes. | Object is not assigned with a primary key. |
5. | Entity is a part of relational database. | Object is a part of object oriented database. |
6. | Entities are represented in rectangular shape using E-R diagram. | Objects aren’t represented graphically. |
7. | Attributes is a property of entity. | Inheritance, Encapsulation, Polymorphism and Abstraction are part of object. |
8. | Example: Computer, Software. | Example: Minimum age to vote is 18. |