Presentation is loading. Please wait.

Presentation is loading. Please wait.

Entity-Relation Model. E-R Model The Entity-Relationship (ER) model was originally proposed by Peter in 1976 ER model is a conceptual data model that.

Similar presentations


Presentation on theme: "Entity-Relation Model. E-R Model The Entity-Relationship (ER) model was originally proposed by Peter in 1976 ER model is a conceptual data model that."— Presentation transcript:

1 Entity-Relation Model

2 E-R Model The Entity-Relationship (ER) model was originally proposed by Peter in 1976 ER model is a conceptual data model that views the real world as entities and relationships. A basic component of the model is the Entity-Relationship diagram, which is used to visually represent data objects.

3 Utilities of the ER mode It maps well to the relational model. The constructs used in the ER model can easily be transformed into relational tables. It is simple and easy to understand with a minimum of training. Therefore, the model can be used by the database designer to communicate the design to the end user. In addition, the model can be used as a design plan by the database developer to implement a data model in specific database management software.

4 Basic Constructs of E-R Modeling Entities

5 Relationships A Relationship represents an association between two or more entities. Relationships are classified in terms of degree, connectivity, cardinality, and existence. An example of a relationship would be:  Employees are assigned to projects  Projects have subtasks  Departments manage one or more projects

6 Attributes Attributes describe the properties of the entity of which they are associated. A particular instance of an attribute is a value. For example, "Ram" is one value of the attribute Name. The domain of an attribute is the collection of all possible values an attribute can have. We can classify attributes as following:  Simple  Composite  Single-values  Multi-values  Derived

7 Simple Attribute A simple attribute is an attribute composed of a single component with an independent existence. Simple attributes cannot be further subdivided. Examples of simple attributes include Sex, Age, and Salary etc. Simple attributes are sometimes called atomic attributes. Composite Attribute An attribute composed of multiple components, each with an independent existence is called a composite attribute. For example, the Address attribute can be composed of components like Street number, Area, City, Pin code and so on. The decision to model the Address, Area, and City etc. is dependent on whether the user view of the model refers to the Address attribute as a single unit or as individual components.

8 Single-valued Attribute A single-valued attribute is one that holds a single value for a single entity. The majority of attributes are single-valued for a particular entity. For example, the Classroom entity has as single value for the room_number attribute and therefore the room_number attribute is referred to as being single-valued. Multi-valued Attribute A multi-valued attribute is one that holds multiple values for a single entity. Some attribute has multiple values for a particular entity. For example, a student entity can have multiple values for the Hobby attribute—reading, music, movies and so on. A multi-valued attribute may have set of numbers with upper and lower limits. For example, the Hobby attribute of a Student may have between one and five values. In other words, a student may have a minimum of one hobby and maximum of 5 hobbies.

9 Derived Attribute A derived attribute is one that represents a value that is derivable from the value of a related attribute or set of attributes, not necessarily in the same entity. Some attributes may be related for a particular entity. For example the Age attribute can be derived from the date-of-birth attribute and therefore they are related. We refer the age attribute as a derived attribute, the value of which is derived from the date-of-birth attribute.

10 Degree of a Relationship The degree of a relationship is the number of entities associated with the relationship. The n-ary relationship is the general form for degree n. Special cases are the binary, and ternary, where the degree is 2, and 3, respectively.

11 Connectivity and Cardinality The connectivity of a relationship describes the mapping of associated entity instances in the relationship. The values of connectivity are "one" or "many". The cardinality of a relationship is the actual number of related occurrences for each of the two entities. The basic types of connectivity for relations are:  One to One (1:1).  One to Many (1:M)  Many to One (M:1)  Many to Many (M:M)

12 Direction The direction of a relationship indicates the originating entity of a relationship. The entity from which a relationship originates is the parent entity; the entity where the relationship terminates is the child entity. The type of the relation is determined by the direction of line connecting relationship component and the entity. To distinguish different types of relation, we draw either a directed line or an undirected line between the relationship set and the entity set. Directed line is used to indicate one occurrence and undirected line is used to indicate many occurrences in a relation as shown in next case.

13

14

15

16

17

18

19

20

21 Consider the following database: S (S#, SSNAME, STATUS, CITY) P (P#, PNAME, COLOR, WEIGHT, CITY) J ( J#, JNAME, CITY) SPJ( S#, P#, J#, QTY) Here S indicates information of suppliers, P Parts, J Projects and SPJ indicates the supplied quantity details.

22

23 Strong and Weak Entity Sets The entity set which does not has sufficient attributes to form a primary key is called as weak entity set. An entity set that has a primary key is called as Strong entity set. Each weak set must be a part of one-to-many relationship set. A member of a strong entity set is called dominant entity and member of weak entity set is called as subordinate entity. A weak entity set does not have a primary key but we need a means of distinguishing among all those entries in the entity set that depend on one particular strong entity set. The discriminator of a weak entity set is a set of attributes that allows this distinction to be made. For example, payment_number is acts as discriminator for payment entity set. It is also called as the Partial key of the entity set.

24 The primary key of a weak entity set is formed by the primary key of the strong entity set on which the weak entity set is existence dependent, plus the weak entity set’s discriminator. In the above example {loan_number, payment_number} acts as primary key for payment entity set.

25 The relationship between weak entity and strong entity set is called as Identifying Relationship. In example, loan-payment is the identifying relationship for payment entity. A weak entity set is represented by doubly outlined box and corresponding identifying relation by a doubly outlined diamond

26

27 Generalization A generalization hierarchy is a form of abstraction that specifies that two or more entities that share common attributes can be generalized into a higher-level entity type called a supertype or generic entity. The lower level of entities becomes the subtype, or categories, to the super type. Subtypes are dependent entities. Generalization is used to emphasize the similarities among lower-level entity sets and to hide differences. It makes ER diagram simpler because shared attributes are not repeated. Generalization is denoted through a triangle component labeled ‘IS A”,

28

29 Specialization Specialization is the process of taking subsets of a higher-level entity set to form lower level entity sets. It is a process of defining a set of subclasses of an entity type, which is called as superclas of the specialization. The process of defining subclass is based on the basis of some distinguish characteristics of the entities in the super class. For example, specialization of the Employee entity type may yield the set of subclasses namely Salaried_Employee and Hourly_Employee on the method of pay

30

31 Difference between Specialization and Generalization Specialization is the process of taking subsets of a higher-level entity set to form lower level entity sets. Specialization emphasizes differences among entities within the set by creating distinct lower-level entity sets. These lower-level entity sets may have attributes, or may participate in relationships, that do not apply to all entities in the higher-level entity set. Generalization proceeds from the recognition that a number of entities set share some common features, which are described by the same, attributes and participate in the same relationship sets. Generalization is used to emphasize the similarities among lower-level entity sets and to hide differences.

32 Aggregation One limitation of the E-R model is that it cannot express relationships among relationships. To illustrate the need for such a construct, consider the ternary relationship work_on, between on employee branch and job as shown in figure 3.13. The best way to model a situation like this is by the use of aggregation. Thus, the relationship set work_on relating the entity sets Employee, Branch and Job is a higher-level entity set. Such an entity set is treated in the same manner, as is any other entity set. We can then create a binary relationship Manages between work_on and Manager to represent who manages what tasks.

33

34 Suppose a customer loan pair may have a bank emp Who is a loan officer for that particular pair. CUSTLOAN BORROWER LOAN- OFFICER EMP

35 The best way to model the situation is to use aggregation. Aggregation is asn abstraction through which relationship are treated as higher level entities CUST LOAN BORROWER LOAN-OFFICER EMP


Download ppt "Entity-Relation Model. E-R Model The Entity-Relationship (ER) model was originally proposed by Peter in 1976 ER model is a conceptual data model that."

Similar presentations


Ads by Google