In my last post i have discussed basic DBMS terminology now in this post i am going to discuss Entity relationship model. ER-modal related question asked in every IT exam and these are basic to understand database
Attributes - Entities are represented by means of their properties, called attributes. All attributes have values. For example, a student entity may have name, class, age as attributes.
Relationship - The association among entities is called relationship. Relationships are represented by diamond shaped box. Name of the relationship is written in the diamond-box. All entities (rectangles), participating in relationship, are connected to it by a line.
A relationship where two entities are participating, is called a binary relationship. Cardinality is the number of instance of an entity from a relation that can be associated with the relation.
Key is an attribute or collection of attributes that uniquely identifies an entity among entity set. For example, roll_number of a student makes her/him identifiable among students.
An entity set that does not have a primary key is referred to as a weak entity set. The existence of a weak entity set depends on the existence of a identifying entity set .In entity relationship diagrams a weak entity set is indicated by a bold (or double-lined) rectangle (the entity) connected by a bold (or double-lined) type arrow to a bold (or double-lined) diamond (the relationship).
Entity relationship model defines the conceptual view of database. It works around real world entity and association among them. At view level, ER model is considered well for designing databases.
Entity - A real-world thing that can be easily identifiable and distinguishable. For example, in a school database, student, teachers, class and course offered can be considered as entities.
Attributes - Entities are represented by means of their properties, called attributes. All attributes have values. For example, a student entity may have name, class, age as attributes.
TYPES OF ATTRIBUTES:
- Simple attribute - Simple attributes are atomic values, which cannot be divided further. For example, student's phone-number is an atomic value of 10 digits.
- Composite attribute - Composite attributes are made of more than one simple attribute. For example, a student's complete name may have first_name and last_name.
- Derived attribute - Derived attributes are attributes, which do not exist physical in the database, but there values are derived from other attributes presented in the database. For example, average_salary in a department should be saved in database instead it can be derived. For another example, age can be derived from data_of_birth.
- Single-valued attribute - Single valued attributes contain on single value. For example: Social_Security_Number.
- Multi-value attribute - Multi-value attribute may contain more than one values. For example, a person can have more than one phone numbers, email_addresses etc.
BINARY RELATIONSHIP AND CARDINALITY
A relationship where two entities are participating, is called a binary relationship. Cardinality is the number of instance of an entity from a relation that can be associated with the relation.
- One-to-one When only one instance of entity is associated with the relationship, it is marked as '1'.
- One-to-many When more than one instance of entity is associated with the relationship, it is marked as 'N'.
- Many-to-one When more than one instance of entity is associated with the relationship, it is marked as 'N'.
PARTICIPATION CONSTRAINTS
- Total Participation: Each entity in the entity is involved in the relationship. Total participation is represented by double lines.
- Partial participation: Not all entities are involved in the relation ship. Partial participation is represented by single line.
ENTITY-SET AND KEYS
Key is an attribute or collection of attributes that uniquely identifies an entity among entity set. For example, roll_number of a student makes her/him identifiable among students.
- Super Key: Set of attributes (one or more) that collectively identifies an entity in an entity set.
- Candidate Key: Minimal super key is called candidate key that is, supers keys for which no proper subset are a superkey. An entity set may have more than one candidate key.
- Primary Key: This is one of the candidate key chosen by the database designer to uniquely identify the entity set.
An entity set that does not have a primary key is referred to as a weak entity set. The existence of a weak entity set depends on the existence of a identifying entity set .In entity relationship diagrams a weak entity set is indicated by a bold (or double-lined) rectangle (the entity) connected by a bold (or double-lined) type arrow to a bold (or double-lined) diamond (the relationship).
In my next Post I am going to diccuss generalization and specialization.
0 Leave your comment here....:
Post a Comment