Database
A collection of logically related information organized so that it can be easily
accessible, managed, and updated
What is a Database?
A database refers to a collection of logically related information organized so that
it can be easily accessible, managed, and updated. Databases are generally
accessed electronically from a computer system and are usually controlled by a
database management system (DBMS). The database administrator (DBA) is the
individual responsible for managing the databases, including database security,
access control, backup, and disaster recovery.
A database is a persistent collection of logically related data. The initial attempts
were to provide a centralized collection of data. A database has a self describing
nature. It contains not only the data sharing and integration of data of an
organization in a single database.
A small database can be handled manually but for a large database and having
multiple users it is difficult to maintain it, In that case a computerized database is
useful.
The advantages of database system over traditional, paper based methods of record
keeping are:
compactness:
No need for large amount of paper files
speed:
The machine can retrieve and modify the data more faster way then human being
Less drudgery: Much of the maintenance of files by hand is eliminated
Accuracy: Accurate, up-to-date information is fetched as per requirement of the
user at any time.
Database Functions
Database Functions provide you with a mechanism to extend the functionality of
the database server.
A Database Function is a routine that accepts parameters, performs an action (such
as a complex calculation) and returns the result of that action as a value.
Depending on the Function, the return value can be either a single value or a result
set.
Once created, a Database Function can be used as an expression in an SQL
statement.
In Enterprise Architect, Database Functions can be modeled in one of two ways:
As individual objects (the default method) or
As Operations in a container
Summary
A database refers to a collection of logically related
information organized so that it can be easily accessible,
managed, and updated. Databases are generally accessed
electronically from a computer system and are usually
controlled by a database management system (DBMS).
Enterprises typically make use of both internal databases
and external databases. Internal databases typically
include operational databases and data warehouses.
External databases refer to databases external to an
organization and are generally accessed over the Internet
and are owned by other organizations.
The five major components of a database are hardware,
software, data, procedure, and database access language.
What is Data?
Before we get into the concept of a database, we should first understand what data
is. Put simply, data are pieces of information or facts related to the object being
considered. For example, examples of data relating to an individual would be the
person’s name, age, height, weight, ethnicity, hair color, and birthdate. Data is not
limited to facts themselves, as pictures, images, and files are also considered data.
There are a few key terms that would be useful to help one understand data more,
particularly the relation between data and databases.
Fields: Within a database, a field contains the most detailed information about
events, people, objects, and transactions.
Record: A record is a collection of related fields.
Table: A table is a collection of related records with a unique table name
The main feature of data in a database are:
1. It must be well organized
2. it is related
3. It is accessible in a logical order without any difficulty
4. It is stored only once
for example: consider the roll no, name, address of a student stored in a student
file. It is collection of related data with an implicit meaning.
Data in the database may be persistent, integrated and shared.
Persistent:
If data is removed from database due to some explicit request from user to remove.
Integrated:
A database can be a collection of data from different files and when any
redundancy among those files are removed from database is said to be integrated
data.
Sharing Data:
The data stored in the database can be shared by multiple users simultaneously
with out affecting the correctness of data.
What is the Role of Databases in an Enterprise?
Enterprises typically make use of both internal databases and external databases.
Internal databases typically include operational databases and data warehouses.
The former, operational databases, refer to databases that are actively used in the
operations of the business, such as accounting, sales, finance, and HR.
Data warehouses contain data collected from several sources, and the data
contained within are generally not used for routine business activities. Instead, data
warehouses are usually used for business intelligence purposes. External databases
refer to databases external to an organization and are generally accessed over the
Internet and are owned by other organizations. An example of an external database
is the SEC database.
Components of a Database
The five major components of a database are:
1. Hardware
Hardware refers to the physical, electronic devices such as computers and hard
disks that offer the interface between computers and real-world systems.
3. Software
Software is a set of programs used to manage and control the database and includes
the database software, operating system, network software used to share the data
with other users, and the applications used to access the data.
3. Data
Data are raw facts and information that need to be organized and processed to
make it more meaningful. Database dictionaries are used to centralize, document,
control, and coordinate the use of data within an organization. A database is a
repository of information about a database (also called metadata).
4. Procedures
Procedures refer to the instructions used in a database management system and
encompass everything from instructions to setup and install, login and logout,
manage the day-to-day operations, take backups of data, and generate reports.
5. Database Access Language
Database Access Language is a language used to write commands to access,
update, and delete data stored in a database. Users can write commands using
Database Access Language before submitting them to the database for execution.
Through utilizing the language, users can create new databases, tables, insert data,
and delete data.
What is a Database Management System (DBMS)?
A database management system consists of collection of related data and refers to a
set of programs for defining, creation, maintenance and manipulation of a
database. It refers to a collection of programs that enable users to access databases
and manipulate, maintain, report, and relate data. A DBMS is often used to reduce
data redundancy, share data in a controlled way, and reduce data integrity
problems. DBMS is not an information system but is simply software.
Function of DBMS:
1. Defining database schema: it must give facility for defining the database
structure also specifies access rights to authorized users.
2. Manipulation of the database: The dbms must have functions like insertion of
record into database update data, delete data, retrieve data
3. Sharing of database: The DBMS must share data items for multiple users by
maintaining consistency of data.
4. Protection of database: It must protect the database against unauthorized users.
5. Database recovery: If for any reason the system fails DBMS must facilitate data
base recovery.
Advantages of dbms:
Reduction of redundancies:
Centralized control of data by the DBA avoids unnecessary duplication of data and
effectively reduces the total amount of data storage required avoiding duplication
in the elimination of the inconsistencies that tend to be present in redundant data
files.
Sharing of data:
A database allows the sharing of data under its control by any number of
application programs or users.
Data Integrity:
Data integrity means that the data contained in the database is both accurate and
consistent. Therefore data values being entered for storage could be checked to
ensure that they fall with in a specified range and are of the correct format.
Data Security:
The DBA who has the ultimate responsibility for the data in the dbms can ensure
that proper access procedures are followed including proper authentication
schemas for access to the DBS and additional check before permitting access to
sensitive data.
Conflict resolution:
DBA resolve the conflict on requirements of various user and applications. The
DBA chooses the best file structure and access method to get optional performance
for the application.
Data Independence:
Data independence is usually considered from two points of views; physically data
independence and logical data independence.
Physical data Independence allows changes in the physical storage devices or
organization of the files to be made without requiring changes in the conceptual
view or any of the external views and hence in the application programs using the
data base.
Logical data independence indicates that the conceptual schema can be changed
without
affecting the existing external schema or any application program.
Disadvantage of DBMS:
1. DBMS software and hardware (networking installation) cost is high
2. The processing overhead by the dbms for implementation of security, integrity
and sharing of the data.
3. centralized database control
4. Setup of the database system requires more knowledge, money, skills, and time.
5. The complexity of the database may result in poor performance.
Database Architecture in DBMS: 1-Tier, 2-Tier and 3-Tier
What is Database Architecture?
A Database Architecture is a representation of DBMS design. It helps to design,
develop, implement, and maintain the database management system. A DBMS
architecture allows dividing the database system into individual components that
can be independently modified, changed, replaced, and altered. It also helps to
understand the components of a database.
A Database stores critical information and helps access data quickly and securely.
Therefore, selecting the correct Architecture of DBMS helps in easy and efficient
data management.
Types of DBMS Architecture
There are mainly three types of DBMS architecture:
One Tier Architecture (Single Tier Architecture)
Two Tier Architecture
Three Tier Architecture
1-Tier Architecture
1 Tier Architecture in DBMS is the simplest architecture of Database in which
the client, server, and Database all reside on the same machine. A simple one tier
architecture example would be anytime you install a Database in your system and
access it to practice SQL queries. But such architecture is rarely used in
production.
1 Tier Architecture Diagram
2-Tier Architecture
A 2 Tier Architecture in DBMS is a Database architecture where the presentation
layer runs on a client (PC, Mobile, Tablet, etc.), and data is stored on a server
called the second tier. Two tier architecture provides added security to the DBMS
as it is not exposed to the end-user directly. It also provides direct and faster
communication.
2 Tier Architecture Diagram
In the above 2 Tier client-server architecture of database management system, we
can see that one server is connected with clients 1, 2, and 3.
Two Tier Architecture Example:
A Contact Management System created using MS- Access.
3-Tier Architecture
A 3 Tier Architecture in DBMS is the most popular client server architecture in
DBMS in which the development and maintenance of functional processes, logic,
data access, data storage, and user interface is done independently as separate
modules. Three Tier architecture contains a presentation layer, an application layer,
and a database server.
3-Tier database Architecture design is an extension of the 2-tier client-server
architecture. A 3-tier architecture has the following layers:
1. Presentation layer (your PC, Tablet, Mobile, etc.)
2. Application layer (server)
3. Database Server
3 Tier Architecture Diagram
The Application layer resides between the user and the DBMS, which is
responsible for communicating the user’s request to the DBMS system and send
the response from the DBMS to the user. The application layer(business logic
layer) also processes functional logic, constraint, and rules before passing data to
the user or down to the DBMS.
The goal of Three Tier client-server architecture is:
To separate the user applications and physical database
To support DBMS characteristics
Program-data independence
Supporting multiple views of the data
Three Tier Architecture Example:
Any large website on the internet, including [Link].
Summary
An Architecture of DBMS helps in design, development, implementation,
and maintenance of a database
The simplest database system architecture is 1 tier where the Client, Server,
and Database all reside on the same machine
A two-tier architecture is a database architecture in DBMS where
presentation layer runs on a client and data is stored on a server
Three-tier client-server architecture consists of the Presentation layer (PC,
Tablet, Mobile, etc.), Application layer (server) and Database Server
What is Database Design?
Database Design is a collection of processes that facilitate the designing, development,
implementation and maintenance of enterprise data management systems. Properly designed
database are easy to maintain, improves data consistency and are cost effective in terms of disk
storage space. The database designer decides how the data elements correlate and what data must
be stored.
The main objectives of database design in DBMS are to produce logical and physical designs
models of the proposed database system.
The logical model concentrates on the data requirements and the data to be stored independent of
physical considerations. It does not concern itself with how the data will be stored or where it
will be stored physically.
The physical data design model involves translating the logical DB design of the database onto
physical media using hardware resources and software systems such as database management
systems (DBMS).
Why Database Design is Important ?
It helps produce database systems
1. That meet the requirements of the users
2. Have high performance.
Database design process in DBMS is crucial for high performance database system.
Note, the genius of a database is in its design. Data operations using SQL is relatively simple
Database development life cycle
The database development life cycle has a number of stages that are followed when developing
database systems.
The steps in the development life cycle do not necessarily have to be followed religiously in a
sequential manner.
On small database systems, the process of database design is usually very simple and does not
involve a lot of steps.
In order to fully appreciate the above diagram, let’s look at the individual components listed in
each step for overview of design process in DBMS.
Requirements analysis
Planning – This stages of database design concepts are concerned with planning of entire
Database Development Life Cycle. It takes into consideration the Information Systems
strategy of the organization.
System definition – This stage defines the scope and boundaries of the proposed
database system.
Database designing
Logical model – This stage is concerned with developing a database model based on
requirements. The entire design is on paper without any physical implementations or
specific DBMS considerations.
Physical model – This stage implements the logical model of the database taking into
account the DBMS and physical implementation factors.
Implementation
Data conversion and loading – this stage of relational databases design is concerned
with importing and converting data from the old system into the new database.
Testing – this stage is concerned with the identification of errors in the newly
implemented system. It checks the database against requirement specifications.
Two Types of Database Techniques
1. Normalization
2. ER Modeling
Let’s study them one by one
Software Engineering | Object Modeling Technique (OMT)
Object Modeling Technique (OMT) is real world based modeling approach
for software modeling and designing. It was developed basically as a method
to develop object-oriented systems and to support object-oriented
programming. It describes the static structure of the system.
Object Modeling Technique is easy to draw and use. It is used in many
applications like telecommunication, transportation, compilers etc. It is also
used in many real world problems. OMT is one of the most popular object
oriented development techniques used now-a-days. OMT was developed
by James Rambaugh.
Purpose of Object Modeling Technique:
To test physical entity before construction of them.
To make communication easier with the customers.
To present information in an alternative way i.e. visualization.
To reduce the complexity of software.
To solve the real world problems.
Object Modeling Technique’s Models:
There are three main types of models that has been proposed by OMT:
1. ObjectModel:
Object Model encompasses the principles of abstraction, encapsulation,
modularity, hierarchy, typing, concurrency and persistence. Object Model
basically emphasizes on the object and class. Main concepts related with
Object Model are classes and their association with attributes. Predefined
relationships in object model are aggregation and generalization (multiple
inheritance).
2. DynamicModel:
Dynamic Model involves states, events and state diagram (transition
diagram) on the model. Main concepts related with Dynamic Model are
states, transition between states and events to trigger the transitions.
Predefined relationships in object model are aggregation (concurrency)
and generalization.
3. FunctionalModel:
Functional Model focuses on the how data is flowing, where data is stored
and different processes. Main concepts involved in Functional Model are
data, data flow, data store, process and actors. Functional Model in OMT
describes the whole processes and actions with the help of data flow
diagram (DFD).
Phases of Object Modeling Technique:
OMT has the following phases:
1. Analysis:
This the first phase of the object modeling technique. This phase involves
the preparation of precise and correct modeling of the real world
problems. Analysis phase starts with setting a goal i.e. finding the
problem statement. Problem statement is further divided into above
discussed three models i.e. object, dynamic and functional model.
2. SystemDesign:
This is the second phase of the object modeling technique and it comes
after the analysis phase. It determines all system architecture, concurrent
tasks and data storage. High level architecture of the system is designed
during this phase.
3. ObjectDesign:
Object design is the third phase of the object modeling technique and
after system design is over, this phase comes. Object design phase is
concerned with classification of objects into different classes and about
attributes and necessary operations needed. Different issues related with
generalization and aggregation are checked.
4. Implementation:
This is the last phase of the object modeling technique. It is all about
converting prepared design into the software. Design phase is translated
into the Implementation phase.
The Basics of the Object Model
The object Model sees an information system as a set of objects and classes.
The reader will get an in-depth understanding of the object model and its
elements. We will also look into object-oriented programming (OOP), object-
oriented design (OOD), and object-oriented analysis (OOA).
Defining the Object model
Object Model refers to a visual representation of software or systems’
objects, attributes, actions, and relationships. The basic factors of an object
model are classes and objects.
Object
An object is a physical component in the object-oriented domain. An object
may be tangible such as a person, car, or intangible such as a project.
Class
A class is a representation of objects. It represents a group of objects that
have similar properties and exhibit an expected behavior.
Below is an example of a class and a few objects.
Class (Car Brand) = Objects (Toyota, Subaru, Hyundai, Audi, Volkswagen)
An object model uses various diagrams to show how objects behave and
perform real-world tasks. The diagrams used include use-case diagram and
sequence diagram.
The object model describes objects in object-oriented programming, object-
oriented analysis, and object-oriented design.
Understanding OOP, OOD, and OOA
Object-Oriented Programming (OOP)
OOP is a programming paradigm with a view of objects and classes. OOP
incorporates properties/attributes and functions/methods into an element
called an object. These objects are grouped into classes.
This programming style exists in programming languages such as C++, Java,
JavaScript, Python, etc. These languages help structure and organize
systems and software programs quickly.
Developers use Object-Oriented Languages when creating large, complex,
and actively updated programs.
OOP is based on four principles, i.e., Encapsulation, Abstraction, Inheritance,
and Polymorphism.
1. Encapsulation: It’s the bundling of data and methods to control access
into the object. It’s also known as information/data hiding. In other
words, the data is not available to the outside world. Therefore, only
those methods that are within the class can access it.
2. Abstraction: It hides implementation details while presenting the
attributes to the outer world. It reduces code complexity, hides the
facts, and expose the essential parts.
For example:
A database system details how a database is created while hiding how data
is stored and maintained. The user only sees the database results on the
screen.
3. Inheritance: It’s a technique of creating a new class from an existing
one. A sub-class derives features from the parent class(base class).
Inheritance is a mechanism of acquiring the features and behaviors of a class by another class.
The class whose members are inherited is called the base class, and the class that inherits those
members is called the derived class. Inheritance implements the IS-A relationship.
For example, mammal IS-A animal, dog IS-A mammal; Hence dog IS-A animal as well.
Different Types of Inheritance
OOPs support the six different types of inheritance as given below :
1. Single inheritance
2. Multi-level inheritance
3. Multiple inheritance
4. Multipath inheritance
5. Hierarchical Inheritance
6. Hybrid Inheritance
1. Single inheritance
In this inheritance, a derived class is created from a single base class.
In the given example, Class A is the parent class and Class B is the child class since Class B
inherits the features and behavior of the parent class A.
2. Multi-level inheritance
In this inheritance, a derived class is created from another derived class.
In the given example, class c inherits the properties and behavior of class B and class B
inherits the properties and behavior of class B. So, here A is the parent class of B and class B
is the parent class of C. So, here class C implicitly inherits the properties and behavior of class
A along with Class B i.e there is a multilevel of inheritance.
3. Multiple inheritance
In this inheritance, a derived class is created from more than one base class. This inheritance is
not supported by .NET Languages like C#, F# etc. and Java Language.
In the given example, class c inherits the properties and behavior of class B and class A at
same level. So, here A and Class B both are the parent classes for Class C.
4. Multipath inheritance
In this inheritance, a derived class is created from another derived classes and the same base
class of another derived classes. This inheritance is not supported by .NET Languages like C#,
F# etc.
In the given example, class D inherits the properties and behavior of class C and class B as
well as Class A. Both class C and class B inherits the Class A. So, Class A is the parent for
Class B and Class C as well as Class D. So it's making it Multipath inheritance.
5. Hierarchical Inheritance
In this inheritance, more than one derived classes are created from a single base class and
further child classes act as parent classes for more than one child classes.
In the given example, class A has two childs class B and class C. Further, class B and class C
both are having two childs - class D and E; class F and G respectively.
6. Hybrid inheritance
This is combination of more than one inheritance. Hence, it may be a combination of
Multilevel and Multiple inheritance or Hierarchical and Multilevel inheritance or Hierarchical
and Multipath inheritance or Hierarchical, Multilevel and Multiple inheritance.
Since .NET Languages like C#, F# etc. does not support multiple and multipath inheritance.
Hence hybrid inheritance with a combination of multiple or multipath inheritances is not
supported by .NET Languages.
Advantages of Inheritance
1. Reduce code redundancy.
2. Provides code reusability.
3. Reduces source code size and improves code readability.
4. The code is easy to manage and divided into parent and child classes.
5. Supports code extensibility by overriding the base class functionality within child classes.
Disadvantages of Inheritance
1. In Inheritance base class and child class, both are tightly coupled. Hence If you change the
code of parent class, it will affect all the child classes.
2. In a class hierarchy, many data members remain unused and the memory allocated to them is
not utilized. Hence it affects the performance of your program if you have not implemented
inheritance correctly.
4. Polymorphism: The term polymorphism refers to the occurrence of
something in many forms. Objects can be represented in many forms.
In other words, it means an object can perform many functions and
work differently.
For example:
A person in this scenario is the object, performing different functions, and
behaving in distinct ways. While in church, the person behaves like a
follower. While in the market, a person behaves like a customer. While in a
rented house, the person behaves like a tenant. While heading an
organization, the person behaves like a boss.
Object-Oriented Analysis (OOA)
Object-Oriented Analysis assesses the system requirements. It recognizes
the classes and objects and determines the relationship between them.
The primary purpose of OOA is identifying the application domain and
gathering the requirements of the system. It mainly focuses on what the
system will do rather than how it performs the task.
There are three OOA components: Object Modeling, Dynamic Modeling, and
Functional Modeling.
1. Object Modeling: Objects are occurrences in a class.
Object Modeling develops the constant formation of the system concerning
the object.
It recognizes the objects and the relationship between them. It identifies the
attributes and functions of each class.
2. Dynamic Modeling: It explains how objects respond to events.
3. Functional Modeling indicates the processes executed in an object and
how data changes when it moves to objects.
Object-Oriented Design (OOD)
In OOD, a system is a group of objects. It involves designing the objects,
classes, and relationships between classes.
Terms in Object-Oriented Design:
Instance Variables: Data attributes that are specific to an object.
Instance method: Operations that are specific to an object.
Class Variables: Data attributes that are not specific to an object.
Class Method: Operations that are not specific to an object.
Constructors: A unique method that creates and initializes the objects
for a class to perform some operations.
Elements of the Object model
Here are the significant features of the object model.
Abstraction
Abstraction reduces complexity. It comes from the recognizing similarities
between objects. Abstraction takes place when the system stress details
those that are important to the user. It focuses mostly on the outside view of
the object. Data is abstracted when protected by a set of methods, and only
those methods can access data in the object.
Encapsulation
Encapsulation is achieved through information hiding or data hiding to used
to reduce complexity and increase reusability. The user cannot see the inside
of an object or a class, but the object can be accessed by calling the object’s
methods.
Encapsulation and Abstraction are complementary concepts. In Abstraction,
the system focuses on object behavior and functionality. Encapsulation
focuses on implementation that gives rise to action.
Hierarchy
The hierarchy shows the order in which objects in a system are put together.
It also explains the relationship between different parts of a system. Different
properties and functions form a class of the hierarchy.
A hierarchy class is composed of a base class (parent class) and derived
classes (subclass). A derived class inherits the properties of a parent class.
Through hierarchy, a class can be composed of inter-related sub-classes,
that can have their sub-classes until the smallest level of components is
reached.
Here is an example of a class of hierarchy:
In the scenario above, the vehicle is the base class. The objects car, boat,
and aircraft inherit properties of the base class (vehicle). Objects like truck
and van inherit properties from the car. Sailboat and yacht inherit from the
class boat, and helicopter and blimp inherit properties from class aircraft.
Modularity
Modularity refers to dividing a program into components or modules to
reduce the problem’s complexity. Modularity takes place on broad and
powerful applications with multiple classes.
The modules help to manage complexity. Modularity focuses on
implementation. Making modularity and Encapsulation related.
Modularity can be viewed as a way of matching encapsulated abstraction
into basic components. This takes place after the partitioning of a system
into modules.
Hierarchical Data Model Vs. Relational Data Model At A Glance
Hierarchical and relational data modeling paradigms have distinct characteristics, differing
significantly in structure, how they represent data, and their operational mechanisms. Here’s a
high-level look at how they compare.
Hierarchical Data Model Relational Data Model
Stores data hierarchically in tree structure; Uses parent- Organizes data in table form; Uses common f
child relationships relationships between tables
Does not support queries Supports declarative queries
Complex and difficult to design Comparatively easy for users
Less flexible More flexible
What Is A Hierarchical Data Model?
A hierarchical data model organizes data in a tree-like structure. Data elements are represented
as nodes with parent-child relationships. Due to this approach, hierarchical databases are
especially adept at representing structured data with well-defined relationships. Each parent can
have multiple children, but each child has only one parent.
Hierarchical data models were the first to be adopted in enterprise environments, making their
way into various early business computing applications and solutions including file systems,
corporate datastores, and certain specialized databases.
How Do Hierarchical Data Models Work?
In a hierarchical data model, data is organized in a top-down manner, with a single root node at
the top. Each subsequent node in the hierarchy has a parent node, and a child node can have
multiple parent nodes. Retrieving data in a hierarchical model involves traversing the tree-like
structure, starting from the root node and moving down to the desired node—in this capacity, the
model is particularly suited for representing data with clear hierarchical relationships.
This hierarchical arrangement and parent node/child node linkage system makes it ideal for
representing large volumes of data in a structured manner with well-defined and nested
relationships. Hierarchical data models are ideally suited for applications with data that naturally
exhibits a hierarchical structure.
Uses And Examples Of Hierarchical Data Models
A computer file explorer is one of the most well-known examples of hierarchical data models. It
uses a tree structure for file systems, where directories act as parent nodes, and files serve as
child nodes. A primary use case is organizing and managing data in file systems, where
directories and subdirectories are arranged hierarchically.
Hierarchical data models are well-suited for representing organizational structures, such as
company hierarchies and organizational charts. They’re also widely used in representing product
categories in e-commerce platforms, with parent categories branching into subcategories,
allowing for efficient navigation and catalog management.
In recent years, hierarchical data models have been instrumental to the design of information
retrieval systems, formats, and standards like XML and HTML. In XML, elements are structured
hierarchically to allow for the representation of complex data, such as web content, configuration
files, and data exchange between systems. Hierarchical data models are still a viable option for
representing and managing data that exhibits clear parent-child relationships, enabling efficient
storage and retrieval in various domains.
What Is A Relational Data Model?
A relational data model represents data as tables consisting of rows and columns. Each row in a
table represents a specific record, while each column represents an attribute or field.
The relational database management system (DBMS) continues to serve as a reliable workhorse
for the modern enterprise. Most database administrators and developers are accustomed to the
relational data model and its representation of data in tabular form, where data elements are
organized into tables with rows and columns.
How Do Relational Data Models Work?
In the relational data model, data is organized into tables. Each table represents an entity and
each row represents a specific instance of that entity. Relationships between entities are
established through foreign keys, which link one table to another.
This model allows for complex querying and data retrieval using structured query language
(SQL). Relational data models emphasize data normalization to reduce redundancy and maintain
data integrity, and provide powerful mechanisms for filtering, joining, and aggregating data.
The relational data model is renowned for its simplicity, flexibility, and ability to handle
complex data structures efficiently. Subsequently, they are widely used across a diverse range of
applications and industries, though perhaps most prominently in business and enterprise use
cases and environments.
Uses And Examples Of Relational Data Models
Most business datasets—for example, customer information, sales transactions, and inventory
records—are best represented and managed as relational data types. Organizations that employ
relational databases to store, organize, and retrieve this data efficiently have a wealth of tools,
knowledge, and resources at their disposal.
Relational data models are prevalent in enterprise resource planning (ERP) and customer
relationship management (CRM) systems, as well as web development and e-commerce
platforms. Content management systems (CMS), online shopping platforms, and social media
websites use relational databases to store user profiles, posts, comments, and other dynamic
content. The WordPress CMS, which powers nearly half of all websites on the internet, uses
the MySQL relational database as one of its underlying technologies.
Main Differences Between Hierarchical And Relational Data Models
Hierarchical and relational data modeling paradigms have distinct characteristics, strengths, and
weaknesses. While both models serve the purpose of organizing data, they differ significantly in
their structures, data representation, and operational mechanisms.
Data Structure
In terms of data structure, hierarchical data models organize data in a tree-like structure with
parent-child relationships. In contrast, relational data models organize data in tables with rows
and columns.
Relationships
Data model relationships represent the connections or associations between different entities or
data tables within a database. These relationships define how data from one entity relates to data
in another, providing a crucial means to establish connections, dependencies, and constraints in
the data structure.
Common types of relationships include one-to-one, one-to-many, and many-to-many, each
reflecting the cardinality of how data elements in one entity correspond to those in another. In
general, hierarchical data models represent one-to-many relationships effectively, but struggle
with many-to-many relationships. Relational data models can handle both one-to-many and
many-to-many relationships efficiently through foreign keys and join operations.
Flexibility
Hierarchical data models are better-suited for data applications with clear hierarchical structures;
complex data relationships can be difficult to model using a hierarchical approach. Relational
data models tend to be more flexible in this regard and adaptable to a wide range of data
structures and relationships.
Complexity
If you look at a typical org chart, it’s not hard to quickly identify the key leaders and decision-
makers in the organization. Hierarchical data models are simpler to design and understand for
hierarchically structured data, whereas relational data models can handle complex data scenarios
but may require more complex queries and joins.
Main Similarities Between Hierarchical And Relational Data Models
Despite their differences, hierarchical and relational data models share some characteristics. Here
are the most common:
Storage and retrieval. When implemented correctly, both allow data professionals to better
organize and structure data for efficient storage and retrieval and provide mechanisms to ensure
data integrity and consistency through various constraints and relationships.
Search and query. Both models support querying and data retrieval, although the methods and
languages used may differ (for example, traversal in hierarchical models, SQL in relational
models).
Data normalization. Lastly, both models emphasize data normalization to reduce redundancy
and improve data consistency, though normalization is generally more of a concern with
relational data models.
Normalization involves organizing data in such a way that it minimizes redundancy and ensures
data integrity while maintaining relational connections between tables. One of the primary
reasons for data normalization is to reduce data duplication.
Breaking down data into separate tables and eliminating repetitive information saves storage
space and enhances data consistency. This not only reduces the risk of data inconsistencies but
also makes it easier to update and maintain the database, as changes only need to be made in one
place rather than multiple locations.
When To Use Hierarchical Data Models
The choice between hierarchical and relational data models depends on the nature of the data and
the specific requirements of your application. The following guidelines and example use cases
can help you decide when to use a hierarchical data model.
Organizational Structures
When representing organizational hierarchies, such as company departments or reporting
structures, the hierarchical data model can be effective for clearly conveying levels of rank and
priority.
File Systems
File systems on computers and servers often follow a hierarchical structure, making the
hierarchical data model a natural fit for data modeling in this context.
Taxonomies And Classification
When dealing with data that can be categorized into hierarchical taxonomies, such as product
categories or species classifications, hierarchical models work better than relational models for
visually representing descent and cascading effects.
Simple Hierarchies
Lastly, hierarchical data models are ideal for representing data with clear, relatively simple
hierarchical relationships.
When To Use Relational Data Models
The following guidelines and example use cases are better-suited to the relational data model
than the hierarchical.
Complex/Many-To-Many Relationships
The relational data model is better equipped to handle scenarios with many-to-many
relationships, where one entity can be related to multiple others (and vice versa). For example,
when dealing with data that involves complex relationships between entities, such as customer
orders, products, and suppliers, the relational data model is usually a more flexible option.
Ad Hoc Queries And Data Integration
Relational data modeling and their RDMBs allow for ad hoc querying and reporting capabilities
using SQL-based querying—a significant advantage for data professionals looking to customize
their organizations’ business intelligence instruments. And in scenarios where data needs to be
integrated from various sources and consolidated into a single database, the relational data model
is a more streamlined option for facilitating this process.
Bottom Line: Hierarchical Vs. Relational Data Models
Both hierarchical and relational data models have strengths and weaknesses, making them
uniquely suitable for specific use cases. While the hierarchical data model excels in representing
simple hierarchical structures, the relational data model provides more flexibility and can handle
complex relationships effectively.
Ultimately, your decision should be guided by the nature of your data and the requirements of
your application/use case—and in many cases, a hybrid approach may also be possible through
integrating hierarchical data into a relational database for a best-of-breeds approach.
Difference between Hierarchical, Network and Relational Data Model
[Link]:
Hierarchical data model is the oldest type of the data model. It was developed by IBM in 1968. It
organizes data in the tree-like structure. Hierarchical model consists of the following :
It contains nodes which are connected by branches.
The topmost node is called the root node.
If there are multiple nodes appear at the top level, then these can be called as root segments.
Each node has exactly one parent.
One parent may have many child.
Figure – Hierarchical Data Model
In the above figure, Electronics is the root node which has two children i.e. Televisions and
Portable Electronics. These two has further children for which they act as parent. For example:
Television has children as Tube, LCD and Plasma, for these three Television act as parent. It
follows one to many relationship.
2. Network Data Model:
It is the advance version of the hierarchical data model. To organize data it uses directed graphs
instead of the tree-structure. In this child can have more than one parent. It uses the concept of
the two data structures i.e. Records and Sets.
Figure – Network Data Model
In the above figure, Project is the root node which has two children i.e. Project 1 and Project 2.
Project 1 has 3 children and Project 2 has 2 children. Total there are 5 children i.e Department A,
Department B and Department C, they are network related children as we said that this model
can have more than one parent. So, for the Department B and Department C have two parents i.e.
Project 1 and Project 2.
3. Relational Data Model:
The relational data model was developed by E.F. Codd in 1970. There are no physical links as
they are in the hierarchical data model. Following are the properties of the relational data model :
Data is represented in the form of table only.
It deals only with the data not with the physical structure.
It provides information regarding metadata.
At the intersection of row and column there will be only one value for the tuple.
It provides a way to handle the queries with ease.
Figure – Relational Data Model
Difference between Hierarchical, Network and Relational Data Model:
S. Hierarchical Data
No. Model Network Data Model Relational Data Model
In this model, to store It organizes records in the
data hierarchy method is It organizes records to one form of table and
1. used. It is the oldest another through links or relationship between
method and not in use pointers. tables are set using
today. common fields.
To organize records, it It organizes records in the form It organizes records in the
2.
uses tree structure. of directed graphs. form of tables.
S. Hierarchical Data
No. Model Network Data Model Relational Data Model
In addition to 1:1 and 1:n it In addition to 1:1 and 1:n
It implements 1:1 and 1:n
3. also implements many to many it also implements many
relations.
relationships. to many relationships.
The logical representation
Pointers are used to
A linked list is used to is used with rows and
establish relationships
4. establish a relationship among columns to depict
among records
records physically. relationship among
physically.
records.
Insertion anomaly exits
in this model i.e. child There is no insertion
5. There is no insertion anomaly.
node cannot be inserted anomaly.
without the parent node.
Deletion anomaly exists
in this model i.e. it is There is no deletion
6. There is no deletion anomaly.
difficult to delete the anomaly.
parent node.
Update leads to Updating a record is easy
inconsistency problems and simple with the
No such problem as only one
7. because of the existence process of normalization,
instance of records exist.
of multiple instances of a the redundant data gets
child record. removed.
8. This model lacks data There is partial data This model provides data
S. Hierarchical Data
No. Model Network Data Model Relational Data Model
independence. independence in this model. independence.
No such facility for
No such facility for querying SQL-based declarative
9. querying database is
database is supported. querying is supported.
supported.
It is used to access the It is used to access the data It is used to access the
10. data which is complex which is complex and data which is complex
and asymmetric. symmetric. and symmetric.
Difficult to design a database
It is easy to comprehend
Difficult to design a and manipulate a database
due to concealed physical
11. database because of its because of its complexity.
level details from end-
complexity. Hence, it imposes a burden on
users.
the programmer.
It is flexible as compared to the It is flexible as compared
12. It is less flexible.
hierarchical model. to the hierarchical model.
VAX-DBMS, DMS-1100 of It is mostly used in real
&XML and XAML use
13. UNIVAC and SUPRADBMS’s world applications.
this model.
use this model. Oracle, SQL.