Thursday, November 27, 2008

ATTRIBUTES IN DBMS AND ER MODELING

Attributes
* The set of possible values for an attribute is called the domain of the attribute
Example:
o The domain of attribute marital status is having four values: single, married, divorced or widowed.
o The domain of the attribute month is having twelve values ranging from January to December.
* Key attribute: The attribute (or combination of attributes) that is unique for every entity instance
o E.g.: the account number of an account, the employee id of an employee etc.
* If the key consists of two or more attributes in combination, it is called a composite key
Simple Vs composite attribute
* Simple attribute: cannot be divided into simpler components
E.g.: age of an employee
* Composite attribute: can be split into components
E.g.: Date of joining of the employee.
* Can be split into day, month and year
Single Vs Multi-valued Attributes
* Single valued : can take on only a single value for each entity instance
E.g.: age of employee. There can be only one value for this.
* Multi-valued: can take up many values
E.g.: skill set of employee
stored Vs Derived attribute
* Stored Attribute: Attribute that need to be stored permanently.
+ E.g.: name of an employee
* Derived Attribute: Attribute that can be calculated based on other attributes.
+ E.g. : years of service of employee can be calculated from date of joining and current date
Regular Vs. Weak entity type
* Regular Entity: Entity that has its own key attribute (s).
E.g.: Employee, student ,customer, policy holder etc.
* Weak entity: Entity that depends on other entity for its existence and doesn’t have key attribute (s) of its own
E.g. : spouse of employee
Relationships
* A relationship type between two entity types defines the set of all associations between these entity types
* Each instance of the relationship between members of these entity types is called a relationship instance
* E.g if Works-for is the relationship between the Employee entity and the department entity, then Rohan works-for CSE department,
Riya works – for EEE department ..etc are relationship instances of the relationship, works-for
Degree of a Relationship
* Degree: the number of entity types involved
# One Unary
# Two Binary
# Three Ternary
E.g: employee manager-of employee is unary
employee works-for department is binary
customer purchase item, shop keeper is a ternary relationship
Cardinality
* Relationships can have different connectivity
o one-to-one (1:1)
o one-to-many (1:N)
o many-to- One (M:1)
o many-to-many (M:N)
E.g.:
Employee head-of department (1:1)
Lecturer offers course (1:N) assuming a course is taught by a single lecturer
Student enrolls course (M:N)
Relationship Participation
* Total : Every entity instance must be connected through the relationship to another instance of the other participating entity types
* Partial: All instances need not participate
E.g.: Employee Head-of Department
Employee: partial
Department: total
ER Modeling - Notations
Steps in ER Modeling
* Identify the Entities
* Find relationships
* Identify the key attributes for every Entity
* Identify other relevant attributes
* Draw complete E-R diagram with all attributes including Primary Key
* Review your results with your Business users

These are some issues regarding attributes and ER modeling.
Some content taken from wikipedia.

1 comment:

jimsun said...

it was useful for me ......thank you...............