Greetings!We have recently published 100+ articles on android tutorials with kotlin and java. If you need, you may visit Android Tutorial for beginners page. You can also check Kotlin Tutorial for beginners. Also, if you are interested in content writing, you can mail us at email@example.com.
Now, we will go through basic concepts of ER Model in DBMS. We will see types of data model, entities and attributes, different types of attributes in ER Model in DBMS.
Do you know what is Model?
A model is an abstraction process that hides details not required while highlighting details required to the applications at hand. A data model is a mechanism that provides this abstraction for database applications. Data modeling is used for representing entities of interest and their relationships in the database. The various data models fall into three groups:
- Object based logical models
- Record based logical models
- Physical models
1. Object Based Logical Models
Object based logical models are used in describing data at the logical and view levels. There are many different models under this.
- I. The Entity Relationship Model
- II. The Object-Oriented Model
- III. The Semantic Data Model
- IV. The Functional Data Model
2. Record Based Logical Models
Record based logical models are used in describing data at the logical and view levels. In contrast to object based data models, they are used both to specify the overall logical structure of the database and to provide a higher-level description of the implementation. The three most widely accepted record based data models are
3. Physical Models
Physical Data models are used to describe data at the lowest level, In Contrast to logical data modes, there are few physical data models in use. Two of the widely known ones are the unifying model and the frame memory model.
Concepts of ER Model in DBMS
The ER model in dbms helps to design it for any given enterprise schema and also helps to represent the overall logical structure of a database. The E-R model helps to represent the meaning of the data; which is the semantic aspect of the model.
– Entities and Attributes
Entity is the basic object of the E-R model, which is a “thing” in the real world with an independent existence i.e. it is distinguishable from other objects. An entity may be an object with a physical existence, a concrete entity, a particular person-car, house or employee or it may be an object with a conceptual existence, an abstract entity- a company, a job, or a university course.
An entity set is a set of entities of the same type that share the same properties or attributes. For example: Set of people working in a company becomes an Employee Entity Set. Where each entity member i.e. each member has the attributes as empno, empname, empdept, sal etc.
Another example: Set of all people who are customers for an enterprise can be called as a Customer Entity Set.
Each entity is described by a set of properties called as attributes. For example: A person entity is described as Person-name, Person-age and Person-address. Attributes are descriptive properties of a each member of an entity set. A particular entity will have a value of its attribute. It is this value of the attributes for ach entity that is stored in database. For each attribute, there is a set of permissible values for that attribute, called the Domain of the attribute. For example: Domain for Empno attribute of Employee entity is the set of all positive integers.
Type of Attributes
There are several types of attributes that appear in ER model.
- Simple or Atomic and Composite attributes: Simple attributes are those attributes that are not divisible into subparts. Composite attributes are those attributes that can be divided into smaller sub parts.
For example: An employee name is an attribute for an Employee Entity. This attribute Name is a Composite attribute since it can be further divided into subparts as First name, Middle name, Last name. These subparts i.e. First name, Middle name and Last name in turn form simple attributes since they can’t be further subdivided into parts.
Another example of a composite attribute is Empaddress attribute. This attribute i.e. Empaddress can be divided into subparts as street-no, street-name, city, pin.
- Single valued and multivalued attributes: Attributes that have a single value for a particular entity are called Single valued attributes.
For example: Age is a single valued attribute of a person
Attributes that have a set of values for a particular entity are called multivalued attributes.
For example: College degrees attribute for a person is a multivalued attribute, since a person can have multiple degrees depending on his educational qualifications. Another example is of dependents-name of an employee, since an employee can have zero, one or more dependents. The attribute dependent name of the Employee entity will have different values for different employees of the Employee entity set, this dependent-name becomes a multivalued attribute.
- Store and derived attributes: In some cases the attribute value are related when the value of an attribute can be derived from the value of another attribute then it is said to be a derived attribute.
For example: Given an attribute birthdate the age can be derived from the attribute birthdate for an employee. So here the age attribute becomes derived attribute, whereas birthdate is called second attribute. Some attribute values can be derived from related entities.
For example: An attribute ‘Number-of-employees’ of the department entity can be derived by counting the number of employees related to the department.
- Null attributes: Whenever an entity doesn’t have any applicable values for an attribute, then the attribute is given a NULL value. A NULL value is used when an entity doesn’t have a value for an attribute.
For example: In case of “Telephone no” attribute for an employee entity set, if an employee doesn’t have a Telephone connection then the value of the “Telephone no” attribute is set to NULL.
Relationships, Relationships Sets
For example: We can define a relationship between an Employee E1, and the department in which he works say D, So this becomes a relationship between an entity set Employee and an entity set Department. The above relationship says that E1 works for a department named d1.
For example: Consider two Entity sets Student and Class as shown below. “Belongs-to” is a relationship set defined on the above 2 entity sets, which denotes the association between Students and the Class in which they are studying. The association as shown below.
We will cover other remaining parts of ER Model in DBMS in next post.