You are on page 1of 33

Advanced Data Models

Database Administration
6th Semester
GDC Thana
Data Models

• A data model is a model that describes in an abstract way how data is


represented in an information system or a database management system.
Database Model

• A database model is a data model for a database system. It provides a theory or

specification describing how a database is structured and used.

• A Database model defines the logical design and structure of a database and defines

how data will be stored, accessed and updated in a database management system
Types of Database Models
GDC Thana
Semester 6th
Four Common Types of Database Models
• Database Model that are useful for different types of data or information. Depending upon your specific needs, one of
these models can be used.

✓ Relational databases.

✓ Hierarchical databases.

✓ Network databases.

✓ Object-oriented databases.
Relational Database

• A Relational Database management system refers to the various software systems used to
maintain Relational Databases (RDBMS). The data in this type of Database Model is organized

in two-dimensional tables with rows and columns, and the relationship is maintained by

storing a common field. There are three main parts to it.

• Some examples of specific systems that use RDBMS include IBM, Oracle, MySQL, Microsoft
SQLServer
Relational Database Model

• Three key terms, relations, attributes, and domains, are frequently used in Relational

Models. A table with rows and columns is what a Relation is. In relational

databases, Attributes are the defining characteristics or properties that define all items

belonging to a particular category and are applied to all cells in a column. The Domain is

nothing more than the set of values that the attributes can take.
Parameters in Relational Model

• Tuple: A tuple is a single row in a table.


• Cardinality Of a Relation: The cardinality of a relationship is determined by the
number of tuples in it. The relation has a cardinality of 4 in this case.

• Degree Of a Relation: Each tuple column is referred to as an attribute. The


degree of a relationship is determined by the number of attributes in it. The
degree of the relationship in the figure is 3.
• A primary key and a foreign key are both important concepts in relational databases.

• A primary key is a unique identifier for each row in a table. It ensures that each row can be
uniquely identified and is used to enforce data integrity and to establish relationships between

tables. A primary key cannot contain null values and must be unique for each row in the table.

• A foreign key is a field in a table that is used to reference the primary key of another table. It is
used to establish a relationship between two tables, with the foreign key representing the "many"

side of a one-to-many relationship. The foreign key must have a matching value in the primary key

of the referenced table, or it can be null if the relationship is optional.

• In summary, a primary key uniquely identifies a row in a table, while a foreign key establishes a
relationship between two tables by referencing the primary key of another table.
Example of Relational Database Model
MySQL

MySQL is an open-source relational database management

system (RDBMS) based on Structured Query Language (SQL).

MySQL runs on virtually all platforms, including Linux, UNIX, and

Windows.
Hierarchical Database Model
GDC Thana
Semester 6th
Hierarchical Database Model

• The hierarchical database model is a data model in which data is organized into a
tree-like structure, with each record having one parent record and one or more child

records. This model is based on the concept of parent-child relationships, where

each child record can have only one parent record and each parent record can have

multiple child records.


Hierarchical Databases

• In a hierarchical database, data entities are organized in a way that reflects their
hierarchical relationships. For example, in a company's hierarchical database, the

president of the company would be at the top of the hierarchy, followed by the vice

presidents, then the managers, and so on. Each employee would be a child record of the

manager they report to, and the manager would be the parent record.
Examples of hierarchical database

Organizational Chart: A company's hierarchical structure can be represented in a hierarchical database. For

example, the CEO would be the root node, followed by the different departments, and then the employees

within each department. Each employee would be a child of their respective department.

File System: A file system on a computer can be represented as a hierarchical database, where the

root directory is the parent node and the subdirectories and files within each directory are the child

nodes.
Example
Network Database

• The network database model is a type of database model that was popular in the 1960s and

1970s. It is a hierarchical data model that is based on the concept of a network, where records are

connected to each other in a tree-like structure.

• In the network database model, records are organized in a set of linked records or nodes, which

are connected by relationships or pointers. Each record can have multiple parent and child

records, allowing for complex and flexible data relationships.


Network Database

• The network database model was created to solve the shortcomings of the

hierarchical database model. In this type of model, a child can be linked to

multiple parents, a feature that was not supported by the hierarchical data

model. The parent nodes are known as owners and the child nodes are called

members.
Features
• The features of a Network Model are as follows −

• Ability to Merge Relationships − In this model, because of more relationships the data is more related. It
has an ability to manage one-to-one relationships as well as many-to-many relationships.

• Many paths − There can be more than one path to the same record because of more relationships. It
makes data access fast and simple.

• Circular Linked List − The operations in this model are done with the help of the circular linked list. The
current position is maintained with the help of a program and navigates through the records based on
relationships.
object-oriented database model
Semester 6th
object-oriented Database model
• The object-oriented database model is a type of database model that is based on the
principles of object-oriented programming. In this model, data is represented as objects,
which have properties (attributes) and behaviors (methods).

• In an object-oriented database model, data is organized into classes, which define the
structure and behavior of objects. Each object belongs to a class and has a unique
identity. Objects can communicate with each other through methods, which are
functions that define the behavior of the object.
• Object-oriented databases offer several advantages over other database models. One advantage

is that they can store complex data structures, such as lists, trees, and graphs, more easily than

other models. They also provide better support for inheritance and polymorphism, which are key

concepts in object-oriented programming.

• However, object-oriented databases also have some limitations. For example, they can be more

complex to design and implement than other database models. They may also be less efficient for

certain types of queries, such as those that require complex joins or aggregation.

• Overall, the object-oriented database model is a powerful tool for storing and managing complex

data structures, especially in applications that require a high degree of flexibility and extensibility.
Need of Object Oriented Data Model

• To represent the complex real world problems there was a need for a

data model that is closely related to real world. Object Oriented Data

Model represents the real world problems easily.

Object Oriented Data Model =



Combination of Object Oriented Programming + Relational database model
components of an Object-Oriented Data
Model are as follows:
Objects: An object is an instance of a class that has attributes (properties) and methods (functions) that

define its behavior.

Classes: A class is a blueprint or a template for creating objects. It defines the properties and behaviors that

an object will have.

Encapsulation: Encapsulation is the mechanism that binds together the data and functions that manipulate

the data, and keeps both safe from outside interference and misuse.
components of an Object-Oriented Data
Model are as follows:
Inheritance: Inheritance is the ability of a class to inherit properties and methods from a parent class. It allows for code
reuse and enables the creation of specialized classes that share common attributes and behaviors.

Polymorphism: Polymorphism is the ability of objects to take on different forms or behaviors depending on the context in
which they are used. It allows for the creation of more flexible and reusable code.

Methods: A method is a function that is defined in a class and can be called on objects of that class. It defines the
behavior of the object and how it interacts with other objects.

Attributes: Attributes are the properties or data that are associated with an object. They define the state of the object
and can be accessed or modified through the object's methods.
• Object Instances of student, doctor, engineer in above figure.
• Attributes For example: Object is STUDENT and its attribute are Roll no,
Branch, Setmarks() in the Student class.

• Methods For example: Finding a STUDENT marks in above figure as


Setmarks().

• Class For example: Person, Student, Doctor, Engineer in above figure.


• Inheritance For example: as classes Student, Doctor and Engineer are
inherited from the base class Person.

You might also like