CHAPTER 2:- DATABASE MODELS
A database model is a collection of descriptions of data structures and their contained fields,
together with the operations or functions that manipulate them.
A Database model defines the logical design of data. The model describes the relationships
between different parts of the data.
TYPES OF DATABASE MODELS
1. Hierarchical Model
In this model each entity has only one parent but can have several children. At the top of
hierarchy there is only one entity which is called Root.
Advantages
1. It promotes data sharing.
2. Parent/child relationship promotes conceptual simplicity.
3. Database security is provided and enforced by DBMS.
4. Parent/child relationship promotes data integrity.
5. It is efficient with 1: M relationships.
1
Disadvantages
i. Complex implementation requires knowledge of physical data storage characteristics.
ii. Navigational system yields complex application development, management, and use;
requires knowledge of hierarchical path.
iii. Changes in structure require changes in all application programs.
iv. There is no data definition or data manipulation language in the DBMS.
DDL - CREATE, ALTER, and DROP.
DML-SELECT, INSERT, UPDATE, DELETE and are used to store, modify,
retrieve, delete and update data in database.
2. Relational database models
This is a database model that organizes data logically in tables.
A formal theory of data consists of three major components:
(a) A structural aspect, meaning that data in the database is perceived as tables, and only tables,
(b) An integrity aspect, meaning that those tables satisfy certain integrity constraints
(c) A manipulative aspect, meaning that the tables can be operated upon by means of operators
which derive tables from tables.
Here each table corresponds to an application entity and each row represents an instance of that
entity.
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.
Properties of Relational Tables:
Values Are Atomic
Each Row is Unique
Column Values Are of the Same Kind
The Sequence of Columns is Insignificant
2
The Sequence of Rows is Insignificant
Each Column Has a Unique Name
Certain fields may be designated as keys, which mean that searches for specific values of that
field will use indexing to speed them up.
Advantages
i. Structural independence is promoted by the use of independent tables. Changes in a table's
structure do not affect data access or application programs.
ii. Tabular view substantially improves conceptual simplicity, thereby promoting easier database
design, implementation, management, and use.
iii. Ad hoc query capability is based on SQL.
iv. Powerful RDBMS isolates the end user from physical-level details and improves
implementation and management simplicity.
Disadvantages
i. The RDBMS requires substantial hardware and system software overhead.
ii. Conceptual simplicity gives relatively untrained people the tools to use a good system
poorly, and if unchecked it may produce the same data anomalies found in file
systems.
iii. It may promote islands of information problems as individuals and departments can
easily develop their own applications.
3. Network Model
Using records and sets, this model uses a one-to-many relationship approach for the data records.
Multiple branches are allocated for lower-level structures and branches that are then connected
by multiple nodes, which represent higher-level structures within the db. This database modeling
method provides an efficient way to retrieve information and organize the data so that it can be
looked at multiple ways, providing a means of increasing business performance and reaction
time.
3
Example- Network data model for the University system
Advantages
i. Conceptual simplicity is at least equal to that of the hierarchical model.
ii. It handles more relationship types.
iii. Data access is more flexible than in hierarchical and file system models.
iv. Data owner/member relationship promotes data integrity.
v. There is conformance to standards.
4
vi. It includes data definition language (DDL) and data manipulation language (DML) in
DBMS.
Disadvantages
i. System complexity limits efficiency— still a navigational system.
ii. Navigational system yields complex implementation, application development, and
management.
iii. Structural changes require changes in all application programs.
4. Object Oriented Database Models
Object oriented data model is based upon real world situations. These situations are represented
as objects, with different attributes. All these object have multiple relationships between them.
Elements of Object oriented data model
i. Objects
The real world entities and situations are represented as objects in the Object oriented database
model.
ii. Attributes and Method
Every object has certain characteristics. These are represented using Attributes. The behaviour of
the objects is represented using Methods.
iii. Class
Similar attributes and methods are grouped together using a class. An object can be called as an
instance of the class.
iv. Inheritance
A new class can be derived from the original class. The derived class contains attributes and
methods of the original class as well as its own.
Example
An Example of the Object Oriented data model is:
5
Shape, Circle, Rectangle and Triangle are all objects in this model.
Circle has the attributes Center and Radius.
Rectangle has the attributes Length and Breath
Triangle has the attributes Base and Height.
The objects Circle, Rectangle and Triangle inherit from the object Shape.
Advantages
i. Because of its inheritance property, we can re-use the attributes and functionalities. It reduces
the cost of maintaining the same data multiple times. Also, these information is encapsulated
and, there is no fear being misused by other objects. If we need any new feature we can
easily add new class inherited from parent class and adds new features. Hence it reduces the
overhead and maintenance costs.
ii. Because of the above feature, it becomes more flexible in the case of any changes.
iii. Codes are re-used because of inheritance.
iv. Since each class binds its attributes and its functionality, it is same as representing the real
world object. We can see each object as a real entity. Hence it is more understandable.
Disadvantages
i. It is not widely developed and complete to use it in the database systems. Hence it is not
accepted by the users.
ii. It is an approach for solving the requirement. It is not a technology. Hence it fails to put it in
the database management systems.
The Importance of Data Models
i. Reduced cost. You can build applications at lower cost via data models. Data modeling
typically consumes less than 10 percent of a project budget, and can reduce the 70
percent of budget that is typically devoted to programming. Data modeling catches errors
6
and oversights early, when they are easy to fix. This is better than fixing errors once the
software has been written or – worse yet – is in customer hands.
ii. Higher quality. Just as architects consider blueprints before constructing a building, you
should consider data before building an app. On average, about 70 percent of software
development efforts fail, and a major source of failure is premature coding. A data model
helps define the problem, enabling you to consider different approaches and choose the
best one.
iii. Faster performance. A sound model simplifies database tuning. Database Tuning is
the activity of making a database application run more quickly. A well-constructed
database typically runs fast, often quicker than expected.
iv. Fewer application errors. A data model causes participants to crisply define concepts
and resolve confusion. As a result, application development starts with a clear vision.
Developers can still make detailed errors as they write application code, but they are less
likely to make deep errors that are difficult to resolve.
v. Fewer data errors. Data errors are worse than application errors. It is one thing to have
an application crash, necessitating a restart. It is another thing to corrupt data in a large
database.
vi. Data models can facilitate interaction among the designer, the applications
programmer, and the end user.
vii. A well- developed data model can even foster improved understanding of the
organization for which the database design is developed.
Choosing a database model
i) Database management system support of the model.
Most database management systems are built with a particular data model in mind and require
their users to adopt that model, although some do support multiple models.
ii) Stages of the database design process.
High-level conceptual data models are best for mapping out relationships between data in ways
that people perceive that data. Record-based logical models, on the other hand, more closely
reflect ways that the data is stored on the server.
iii) How valuable or important are the relationships in the data for our application
7
How many relationships are in the data?
How complex are those relationships, i.e. how many types of relationships are there and do
those relationships have properties or annotations?
How frequently does the application query relationships as part of user requests?
iv. Performance and Operational Complexity
Simpler data models are easier to reason about from a performance perspective and often
have less overhead. In addition, the mapping from the logical data model to the physical
representation of the data inside the system is more straightforward.