CONCEPTS OF E-R MODEL
CONTENTS Entity Attributes Data Value Entity Types Types of Entity Types Relationships Relationship Constraints
Entity An entity is a person, place, thing, event or concept about which information is stored in database. e.g. student, supplier, part, car, bank, university, some deal, some event etc. Types of Entity : Entities are of two types : Tangible Entity Intangible Entity
Entity Contd.. Tangible Entity : An entity which has physical existance is called tangible entity. e.g. parts, supplier etc. Intangible Entity : It is one which does not exist physically. e.g. Some deal, some event etc.
Attributes Attribute gives the characteristics of the entity. e.g. Attributes of a student can be Roll No., Name, Class etc. The attributes of a car can be Regn. No., Color, Model etc. An attribute is also called data elements or field or data item.
Attributes Contd.. Types of Attributes : Single valued and multi valued attributes: An attribute which have a single value for particular entity is known as single valued attributes. For example age of employee. An attribute which have a set of values for the same entity is known as multi valued attributes. For example colors for a car.
Attributes Contd.. Composite versus Simple attributes: The attributes which can be divided into smaller independent attribute called composite attributes. For example address of the employee entity can be divided into house no, city, state, pin etc. The attributes which can not be divided into smaller subparts are called simple or atomic attributes. For example age of employee entity. Data Value A data value is actual data or information contained in each data element.
Attributes Contd.. Stored verses Derived attributes: An attribute which can be derived from another attributes is known as derived attribute. For example age of an employee can be determined from the today’s date and Birthdate. Complex attributes: If an attribute for an entity is built using composite and multi valued attributes, such as attributes is called complex attributes.
Attributes Contd.. For example, If a person can have more than one residence and each residence can have multiple phones, an attribute addressphone for a person entity can be specified as: {addressphhone (phone {(area code, phone number)}, address(selector address(selector number, house number), city, state, pin))} Here {} are used to enclose multivalued attributes and () are used to enclose composite attributes with comma separating individual attributes
For example, If a person can have more than one residence and each residence can have multiple phones, an attribute addressphone for a person entity can be specified as: {addressphhone (phone {(area code, phone number)}, address(selector address(selector number, house number), city, state, pin))} Here {} are used to enclose multivalued attributes and () are used to enclose composite attributes with comma separating individual attributes Attributes Contd..
Data Value It is actual data or information contained in each attribute. e.g. Roll No. can take value Null Value : An attribute has null value if either the value of an attribute is not known or not applicable to that entity. e.g. if a person does not have any degree then college degree attribute value will be null.
Entity Types ENTITY TYPE :EMPLOYEE Attributes Name Age Pay E1 (Amit ) E2 (Sunil ) ……………… ………………. An entity type is defined as a collection of entities that have the same attributes. For example employee in a company database. The employee entities share the same attributes, but such entity has its own value for each attributes
Entity Types Contd.. An entity type is represented in ER diagram as a rectangular box enclosing the entity type name. Attribute name is enclosed in ovals and are attached to their entity type by straight lines as shown in following figure: Employee Name AgePay
Types of Entity Types Weak Entity type: An entity type that do not have any key attribute is called weak entity-type. The weak entity type is also called the child entity type or the subordinate entity type. Following symbol is used for weak entity type:
For example : Name SexAge Types of Entity Types Contd..
Strong Entity type: Entity that have key attribute are called strong entity type. The strong entity type is also called regular entity type. For Example: Roll NameSex Student Age
Relationships Relationships which connect entities and represent meaningful dependencies between them. The way in which two or more entity types are related is called relation type. In ER diagram, relationship types are represented by diamond shaped box.
Relationship Constraints There are two types of relationship constraints. 1. Participation Constraints 2. Cardinality Ratio Participation Constraints: It specifies whether the existence of an entity depends on another entity via the relationship type. Total Participation: In total participation every entity in entity set must be depend on another entity.
Relationship Constraints Contd.. Partial Participation: In partial participation, some entities in entity set are depend on another entity. Cardinality Ratio : Cardinality ratio for a binary relationship specifies the number of relationship instances that an entity can participate in a relation set. There are four types of cardinality ratios.
Relationship Constraints Contd.. One to one (1:1) : The relationship between a Department and a Manager is usually one-to-one as shown in figure: Department Manager
Relationship Constraints Contd.. One to many (1:N): The relationship between manager and employee is one- to-many, because there are several employees reporting to the manager as shown in following figure: Employee Manager
Relationship Constraints Contd.. Many to one(N:1): The relationship between Dependent and employee is many to one as shown in following figure: Employee Dependent
Relationship Constraints Contd.. Many to many(M : N) : The relationship between Employee and Project is many to many as shown in following figure: Employee Project
THANKS