Ch2 : DATA MODELS
• Data Model is a logical structure of Database. It describes the design of
database to reflect entities, attributes, relationship among data,
constraints etc.
• Data Model can be defined as an integrated collection of concepts for
describing and manipulating data, relationships between data, and
constraints on the data in an organization.
• The purpose of a data model is to represent data and to make the data
understandable.
BUSINESS RULES
• Business rules are defined as the specifications that preserve the integrity of
the logical data model.
• The four basic types of business rules are given below :
i) Entity Integrity : Each instance of an entity type must have a unique
identifier that is not null.
ii) Referential Integrity Constraints : The rules concerning the relationship
between entity types.
iii) Domains : The constraints on valid values for attributes. iv) Triggering
Operations : It aims at protecting the validity of attribute values.
BUILDING BLOCKS OF DATA MODEL
There are four building blocks of data model, which are listed as :
1. Entity
2. Attribute
3. Relationship
4. Constraints
1. Entity: An entity is a person, place, thing or event about which the data are
to be collected and stored. An entity is the fundamental item in any data
model as it is distinguishable i.e. each entity occurrence is unique and distinct.
For e.g.: CUSTOMER, STUDENT etc.
2. Attribute: An attribute is the characteristic of any entity. For [Link]
entity can be described by attribute such as name, phone, address, gender.
Each attribute is associated with a set off values called domain.
3. Relationship: A relationship describes an association among entities. For
e.g.: Relationship exists between publisher and book can be described as:
Many books are published by a publisher.
4. Constraints: A constraint is a restriction placed on the data to ensure the
integrity and consistency of the database. They are the rules or checks
according to which the data is forced to be inserted in the database.
Types of Data Models
• Object Based Data Models
• Record Based DataModels
Object based Data Models
• In object based data models, the focus is on how data is represented. The data is
divided into multiple entities each of which have some defining characteristics.
Moreover, these data entities are connected with each other through some
relationships.
• An object data model is a data model based on object-oriented programming,
associating methods (procedures) with objects that can benefit from class hierarchies.
Thus, “objects” are levels of abstraction that include attributes and behavior. An
object-oriented data model is one that extends the individual program space into the
world of persistent object management and shareability.
• Some examples of object based data models are
✔Entity Relationship Data Model
✔Object Oriented Data Model
✔Semantic Data Model
✔Functional Data Model
Entity Relationship Model
• An ER diagram shows the relationship among entity sets. An entity set
is a group of similar entities and these entities can have attributes. In
terms of DBMS, an entity is a table or attribute of a table in database, so
by showing relationship among tables and their attributes, ER diagram
shows the complete logical structure of a database.
Advantages
•Exceptional conceptual simplicity
• Visual representation
• Effective communication tool
• Integrated with the relational data model
Disadvantages
• Limited constraint representation
• Limited relationship representation
• No data manipulation language
• Loss of information content
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 to specify the
overall logical structure of the database and to provide a higher-level
description of the implementation.
• Record based models are so named because the database is structured in fixed
format records of several types. Each record type defines a fixed number of
fields, or attributes, and each field is usually of a fixed length.
• The three most widely accepted record based data models are:
✔ Hierarchical Model
✔ Network Model
✔ Relational Model
Hierarchical Model
• This database model organises data into a tree-like-structure, with a
single root, to which all the other data is linked. The hierarchy starts
from the Root data, and expands like a tree, adding child nodes to the
parent nodes.
• In this model, a child node will only have a single parent node. • This
model efficiently describes many real-world relationships like index of a
book, recipes etc.
• In hierarchical model, data is organised into tree-like structure with one
to-many
relationship between two different types of data, for example, one
department can have many courses, many professors and of-course
many students.
Advantage
1. Simplicity
• Data naturally have hierarchical relationship in most of the practical situations.
Therefore, it is easier to view data arranged in manner. This makes this type of
database more suitable for the purpose.
2. Security
• These database system can enforce varying degree of security feature unlike flat-file
system.
3. Database Integrity
• Because of its inherent parent-child structure, database integrity is highly promoted
in these systems.
4. Efficiency: The hierarchical database model is a very efficient, one when the
database contains a large number of I: N relationships (one-to-many relationships) and
when the users require large number of transactions, using data whose relationships
are fixed.
Disadvantages
1. Complexity of Implementation: The actual implementation of a hierarchical database depends on
the physical storage of data. This makes the implementation complicated.
2. Difficulty in Management: The movement of a data segment from one location to another cause all
the accessing programs to be modified making database management a complex affair. 3. Complexity
of Programming: Programming a hierarchical database is relatively complex because the programmers
must know the physical path of the data items.
4. Poor Portability: The database is not easily portable mainly because there is little or no standard
existing for these types of database.
5. Database Management Problems: If you make any changes in the database structure of a
hierarchical database, then you need to make the necessary changes in all the application programs
that access the database. Thus, maintaining the database and the applications can become very
difficult.
6. Lack of structural independence: Structural independence exists when the changes to the database
structure does not affect the DBMS's ability to access data. Hierarchical database systems use physical
storage paths to navigate to the different data segments. So, the application programs should have a
good knowledge of the relevant access paths to access the data. So, if the physical structure is changed
the applications will also have to be modified. Thus, in a hierarchical database the benefits of data
independence are limited by structural dependence.
Network Model
• In the network data model, data model data are represented by
collections of records. Relationships among data are represented by
links. In this data model, graph data structure is used. It permits a
record to have more than one parent.
Advantages of Network data model
• Conceptual simplicity-Just like the hierarchical model,the network model is
also conceptually simple and easy to design.
• Capability to handle more relationship types-The network model can
handle the one to many and many to many relationships which is real help
in modeling the real life situations.
• Ease of data access-The data access is easier and flexible than the
hierarchical model.
• Data integrity- The network model does not allow a member to exist
without an owner.
• Data independence- The network model is better than the hierarchical
model in isolating the programs from the complex physical storage
details.
Disadvantages
• System complexity- All the records are maintained using pointers and
hence the whole database structure becomes very complex.
• Operational Anomalies- The insertion, deletion and updating
operations of any record require large number of pointers
adjustments.
• Absence of structural independence-structural changes to the
database is very difficult.
Relational Model
• Relational model is the most popular model and the most extensively
used model. In this model the data can be stored in the tables and
this storing is called as relation, the relations can be normalized and
the normalized relation values are called atomic values. Each row in a
relation contains unique value and it is called as tuple, each column
contains value from same domain and it is called as attribute.