Data models in database management system.
By: Rajat Kumar | Last Updated: July 26, 2018
1. Introduction:
Hi techies, in this articles we are going to discuss about different type of data schema models in database management system. A Database model defines the logical design and structure of a database and defines how data will be stored, accessed and updated in a database management system.
Today we are going to discuss about Entity – Relationships model in data models of DBMS. So lets get start.
2. Data models in database management system (DBMS):
A data model is a collection conceptual tools for describing data, data relationships, data semantics, and data consistency constraints.
There are two type of data models:
- Entity – relationships model.
- Relational model.
A) Entity – relationships model:
The E-R data model employs three basic notations:
a. Entity Sets:
An entity set is set of entities of the same type that share the same properties, or attributes. Entity sets do not need to be disjoint. An entity is set of attributes. Each entity has a value for each attribute, there is set of permitted values, called domain, or value set of that attribute
Type of attributes:
- Simple attribute.
- Composite attribute.
- Example: “name” – first name, middle name, last name
- Single valued attribute.
- Example: loan number.
- Multi valued attribute.
- Example: phone number (one person may have one or more number)
- Derived attribute – value of this type of attribute derived from other related attribute or entities.
- Example: attribute age of person also derived or calculate from data of birth of a person.
b. Relationship Set:
A ‘relationship’ is an association among several entities. A relationships set is a set of relationships of same type. The function that an entity play in relationship is called entity role.
- If any entity in a relationship plays different roles than that type of relationship may also have attributes called descriptive attributes.
- The number of entity sets that participate in a relationship set called recursive relationship set.
- The number of entity sets that participate in a relationship set is called degree of the relationship set. For example: binary relationship set has degree 2 involve two entity (0,1).
Type of relationship sets:
It also called mapping cardinalities to express the number of entities to another entity can be associated via relationship set. Assume two entity sets A, B.
- One to one: an entity in set A associated with at most one entity in set B. and one entity in set B associated to at most one entity in set A.
- One to many: an entity in set A associated with any number (zero or more) of entities in set B. and one entity in set B associated to at most one entity in set A.
- Many to one: reverse of one to many.
- Many to many: an entity in set A associated with any number (zero or more) entities in set B. and one entity in set B associated to any number (zero or more) entities in set A.
3. Bonus topic:
3.1 Descriptive Attribute:
Attributes of the relationship is called descriptive attribute. For example, employee works for department. Here ‘works for’ is the relation between employee and department entities. The relation ‘works for’ can have attribute DATE_OF_JOIN which is a descriptive attribute.
3.2 Stored Attribute:
The attribute which gives the value to get the derived attribute are called Stored Attribute. In example above, age is derived using Date of Birth. Hence Date of Birth is a stored attribute.
3.3 Strong Entity:
Entities having its own attribute as primary keys are called strong entity. For example, STUDENT has STUDENT_ID as primary key. Hence it is a strong entity.
3.4 Weak Entity:
Entities which cannot form their own attribute as primary key are known weak entities. These entities will derive their primary keys from the combination of its attribute and primary key from its mapping entity.
That’s it for this article in upcoming articles I am going to explain you about relation schema, E-R diagram and Extended E-R features, different type of keys in database. If you like this article do share with your friends and others. So till than see you have a good day.