Data Models
Data Models
A data model is a collection of concepts that can be used to describe the structure of a
database whereas structure of a database means the data types, relationships and constraints
that should hold on the data.
A database model determines in which manner data can be stored, organized, and manipulated
in a database system. A database model is a theory or specification describing how a database is
structured and used. Several such models have been suggested.
The hierarchical data model organizes data in a tree structure. There is a hierarchy of
parent and child data segments known as Record Type. Data in a series of records, which have a
set of field values attach to it. It collects all the instances of a specific record together as a
record type. These record types are the equivalent of tables in the relational model, and with
the individual records being the equivalent of rows. To create links between these record types,
the hierarchical model uses Parent Child Relationships. These are a 1:N mapping between
record types. For example, an organization might store information about an employee, such as
name, employee number, department, salary. The organization might also store information
about an employee's children, such as name and date of birth. The employee and children data
forms a hierarchy, where the employee data represents the parent record type and the children
data represents the child record type. If an employee has three children, then there would be
three child segments associated with one employee segment. In a hierarchical database the
parent-child relationship is one to many. This restricts a child segment to having only one
parent segment. Hierarchical DBMSs were popular from the late 1960s, with the introduction of
IBM's Information Management System (IMS) DBMS, through the 1970s.
Parent–child relationship: Child may only have one Parent but a mother can have
multiple children. Parents and children are tied together by links called "pointers". A mother will
have a list of pointers to each of her children.
b. Network model
Some data required to be modeled with more than one parent per child. So, the
network model permitted the modeling of many-to-many relationships in data. In 1971, the
Conference on Data Systems Languages (CODASYL) formally defined the network model. The
basic data modeling construct in the network model is the set construct. A set consists of a set
name, an owner record type, and a member record type. A member record type can have that
role in more than one set; hence the multi parent concept is supported. An owner record type
can also be a member or owner in another set. The CODASYL network model is based on
mathematical set theory.
c. Relational model
A database based on the relational model developed by E.F. Codd. A relational database
allows the definition of data structures, storage and retrieval operations and integrity constraints.
In such a database the data and relations between them are organized in tables. A table is a
collection of records and each record in a table contains the same fields.
Certain fields may be designated as keys, which means that searches for specific values
of that field will use indexing to speed them up. Where fields in two different tables take values
from the same set, a join operation can be performed to select related records in the two tables by
matching values in those fields. Often, but not always, the fields will have the same name in both
tables. This can be extended to joining multiple tables on multiple fields because these
relationships are only specified at retrieval time. The RELATIONAL database model is based on
the Relational Algebra (discuss later on).
Relational Database Terminology.
Relation.
In a relation model, data is stored in relation. Relation is another term used for a
table.
Tuple.
Every relation consists of many tuples. Tuples are also called records or rows.
Attribute.
An attribute is a column of a relation.
Domain.
A collection of all possible values of one or more attributes.
Degree.
The number of attributes is called the degree of that relation.
Cardinality.
The number of tuples is called the cardinality of that relation.
A logical data model describes your model entities and how they relate to each other. A
physical data model describes each entity in detail, including information about how you would
implement the model using a particular (database) product.
In a logical model describing a person in a family tree, each person node would have
attributes such as name(s), date of birth, place of birth, etc. The logical diagram would also show
some kind of unique attribute or combination of attributes called a primary key that describes
exactly one entry within this entity.
The physical model for the person would contain implementation details. These details
are things like data types, indexes, constraints, etc.