Data modeling is the process of mapping real-world information stored in databases
to logical representation of that data. Data modeling helps you in many important
ways:
-
It helps you understand relations between various logical entities by providing
a logical view of the current system
-
It helps you plan better for future changes
-
While designing a new database, proper data modeling helps you optimize performance
of your application
In this article, we look at some basic concepts of data modeling.
Views
A data model primarily consists of two views - physical and logical. The physical
view shows database tables, views, columns, relation between tables, etc. The logical
view shows how different pieces of data (for example, Customers and
Orders) are related to each other from a non-technical perspective.
It is a logical blueprint of the physical database.
Note that a data model itself is database agnostic (mostly). The same data model,
for example, can be used to create a SQLServer database or an Oracle database.
Entities
Entities are the primary objects used in a data model. An entity
is a representation of a single type of data. Examples are Customers,
Products, Orders, etc.
Although entities and tables may appear to be similar, do not think of entities
as tables. In the end, one entity can be physically implemented as one or more tables.
Attributes
An attribute describes an aspect of the entity. An entity usually consists
of many attributes. For example, a Customer may have Business Name,
Address, etc.
Relationships
At the physical level, a relation describes how a table is related to another
table within the same database. At the logical level, relationships describe how
different entities are related to each other.
There are three types of logical relationships in a data model: one-to-one,
one-to-many, and many-to-many. A one-to-many relationship,
for example, indicates that for every instance in the parent entity, there could
be 0, 1 or more instances in the child entity.
Hope this gives you a good overview of data modeling. In the next article, I will
discuss an important data modeling technique called Normalization.
|