BASIC CONCEPTS OF ENTITY RELATIONSHIP TOPICS TO BE
BASIC CONCEPTS OF ENTITY RELATIONSHIP
TOPICS TO BE DISCUSSED………………. ü Entity ü Attribute ü Data Value ü Type of Attributes ü Entity type ü Relationship Constraints
Entity An entity is a person, place, thing event or concept about which information is recorded. In banking example of entities are Customers, Bank, Accounts etc. Attribute gives the characteristics of the entity. In other words every entity has some attributes that characterize for it. For example a house can describe by its size, color, age and surroundings. Data Value A data value is actual data or information contained in each data element.
Type of Attributes Single valued and multi valued attributes: An attribute which have a single value for particulars entity is known as single valued attributes. For example age of employee entity. An attribute which have a set of values for the same entity is known as multi valued attributes. For example colors for a car entity. 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.
Stored verses derived attributes: An attributes which can be derived from another attributes is known as derived attribute. For example age of an employee entity can be determined from the date of birth to today’s date. Null value: an attribute for an entity has null value if either the value of that attribute is not known or not applicable to that entity. For example, if a person does not have any degree then college degree attribute value will be null.
Complex attributes: If an attribute for an entity is built using composite and multi valued attributes, such as attributes is called complex 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 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.
Entity Types: An entity type is defined s 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. The entity type employee is shown in following diagram: ENTITY TYPE Attribute Entity Set EMPLOYEE Name Age Pay E 1 (Amit 40 10000) E 2 (Sunil 40 10000) ……………….
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: Name Age Employee Pay
Entity Set: The collection of all entities of a particular type in the database at any point in time is called an entity set. It is also called the extension of entity type. Weak Entity type: An entity type that do not have any key attribute I 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 Sex Age
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 Name Student Sex 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 ad diamond shaped boxes. Degree of a relationship: The number of participating entity types is known as the degree of a relationship type. Binary Relationship: A relationship type of degree two is called binary. Ternary Relationship: A relationship type of degree three is called ternary. .
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. 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: One to one (1: 1) : The relationship between a Department and a Manager is usually one-to-one as shown in figure: Department Manager
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: Manager Employee
Many to one(N: 1): The relationship between Dependent and employee is many to one as shown in following figure: Dependent Employee
Many to many(M : N) : The relationship between Employee and Project is many to many as shown in following figure: Employee Project
THANKS
- Slides: 18