You are on page 1of 139

SCSB5102

ADVANCED DATABASES SYSTEMS


SCSB5102 ADVANCED DATABASES SYSTEMS

UNIT 1 OBJECT ORIENTED DATABASES


UNIT 2 DISTRIBUTED DATABASES
UNIT 3 WEB DATABASES
UNIT 4 INTELLIGENT DATABASES
UNIT 5 CURRENT TRENDS
UNIT 1 OBJECT ORIENTED DATABASES
Database System Concepts and Architecture:
Three-Schema Architecture and Data Independence
 Entity Relationship Model: Entity Types
Entity Sets
 Attributes and keys
 Relationships Types and Instances
 ER Diagrams
 Naming conventions and Design Issues
Object oriented databases – Introduction
Weakness of RDBMS
 Object Oriented Concepts:
Storing Objects in Relational Databases
Next Generation Database Systems
Object Oriented Data Models
 OODBMS Perspectives
 Persistence – Issues in OODBMS
Object Oriented Database Management System Manifesto
Advantages and Disadvantages of OODBMS.
Introduction To Databases
OBJECT ORIENTED DATABASES
• An object-oriented database (OOD) is a database system that can work with complex
data objects — that is, objects that mirror those used in object-oriented programming
languages. In object-oriented programming (OOP), everything is an object.
DISTRIBUTED DATABASES
• A distributed database is a database that runs and stores data across multiple
computers, as opposed to doing everything on a single machine. Typically, distributed
databases operate on two or more interconnected servers on a computer network.
WEB DATABASES
• A Web database is a database application designed to be managed and accessed
through the Internet. Website operators can manage this collection of data and
present analytical results based on the data in the Web database application
INTELLIGENT DATABASES
• An intelligent database is a full-text database with artificial intelligence (AI)
components that interact with users to ensure that users are supplied all relevant
information.
DATABASES AND DATABASE USERS
INTRODUCTION
Data : known facts or raw facts. E.g. names, telephone numbers.

Information : processed data.

Database is a collection of related data. E.g. student table consists of name,


regno, marks.
Database management system (DBMS)
• Database management system (DBMS)

• is a collection of programs that enables users to create and maintain a database.

• A general-purpose software system facilitates the process of defining,


constructing, and manipulating databases for various applications
Database Management System (DBMS)

Collection of interrelated data

Set of programs to access the data

DBMS contains information about a particular enterprise

DBMS provides an environment that is both convenient and efficient to use.


Database Applications
Banking: all transactions

Airlines: reservations, schedules

Universities: registration, grades

Sales: customers, products, purchases

Manufacturing: production, inventory, orders, supply chain

Human resources: employee records, salaries, tax deductions

• Databases touch all aspects of our lives


Purpose of Database System
• In the early days, database applications were built on top of file systems

DRAWBACKS OF USING FILE SYSTEMS TO STORE DATA:


Data redundancy and inconsistency
 Multiple file formats, duplication of information in different files

Difficulty in accessing data


 Need to write a new program to carry out each new task

Data isolation — multiple files and formats


Integrity problems
 Integrity constraints (e.g. account balance > 0) become part of program code
 Hard to add new constraints or change existing ones
Atomicity of updates
 Failures may leave database in an inconsistent state with partial updates carried out

 E.g. transfer of funds from one account to another should either complete or not happen at all

Concurrent access by multiple users


 Concurrent accessed needed for performance

 Uncontrolled concurrent accesses can lead to inconsistencies


 E.g. two people reading a balance and updating it at the same time

Security problems
CHARACTERISTICS OF DBMS
Self-describing nature of DB
 The database system contains data and definition of the database. The data definition is stored on the system catalog, which contains the structure of the files, data type for each data item
and various constraints on the data. The information stored in the catalog is called meta data

Insulation between program, data, and data abstraction


 The structure of the file should be stored separately from the access program so, whenever we modify anything in the DB or access program this will not affect the original structure. We
call this property as program-data-independence

 In object, oriented DB system the operation becomes a part of DB system. This operation consists of two parts called interface and implementation. The interface includes operation name
and data type and implementation represents method of the operation. Thus, the method or the implementation can be changed without affecting the interface is called as program-
operation-independence.

Support of multiple views of data

Sharing of data and multi-user transaction processing


ACTORS ON THE SCENE
Based on the interaction of Database data base users are divided in two
End-users: Types
Casual End users:
• They occasionally access the db, but they may need different information each time.
• The user sophisticated db query language to specify their requirements.
• Ex: queries like “list the trains from Chennai to Delhi?”
Parametric or Naive End users:
• Their job is constantly querying and updating the db using standard types of queries called canned transaction.
• Example: Bank teller, Reservation clerk, etc.
Sophisticated End users:
• They have the thorough knowledge about the db.
• Example: Engineers, Scientist, Business analyst etc. They have thorough knowledge about the DBMS.
• They will implement their applications and meet their complex requirements very easily.
Stand-alone End-users:
• Maintain the personal db by using the readymade program packages.
• This program packages will provide easy-to-use, menu or graphic based interfaces.
Modules-> like -implementing catalog - processing a query language -controlling concurrency -handling recovery of data and security etc.
ADVANTAGES OF DBMS
1. Controlling Redundancy

2. Restricting unauthorized access

3. Providing persistent storage for program objects and data


structure

4. Providing multiple user interfaces:

5. Permitting inferencing and actions using rules:

6. Representing complex relationship among data:

7. Enforcing Integrity Constraint

8. Providing backup and recovery:


A simplified database environment
• A database environment is a collective system of components that comprise and regulates the group of data,
management, and use of data, which consist of software, hardware, people, techniques of handling database,
and the data also.

• Here, the hardware in a database environment means the computers and computer peripherals that are being
used to manage a database, and the software means the whole thing right from the operating system (OS) to the
application programs that include database management software like M.S. Access or SQL Server.

• Again the people in a database environment include those people who administrate and use the system. The
techniques are the rules, concepts, and instructions given to both the people and the software along with the
data with the group of facts and information positioned within the database environment.
A simplified database environment
Database system concepts and architecture
DATABASE SYSTEM CONCEPTS
• Data models:

• Data model is a collection of concepts that can be used to describe the structure of data base

Categories of Data Models:

1) High level or conceptual data model:-

• Conceptual DM provides concepts that explains the different ways to perceive data and uses the concepts such
as entities, attributes, and relationships.

• Entity: represents the real-world object, for example, an employee or project.

• Attributes represent the properties or the further description of the entity. For example employee name or salary.

• Relationship: represents the interaction among the entities. For example work-on relationship between employee
and project.

• Ex: entity-relationship model


2) Low level or Physical DM:-

• This will provide the concept of how the data is stored in the computer

• The storage format is also specified in this Data Model such as, record format, record
ordering and access path.

3) Representational or Implementation DM:-

• This is the intermediate DM between high level and low level.

• It provides the concepts that may be understood by end users but that are not too far removed
from the way data is stored in the computer.

• Ex: relational model, network model, hierarchical model.


• Schema or Intension:

The description of a database is called the schema or intension.

• Instance or occurrences:

Each row in the database i.e. a set of related data.

• Extension or database state or snapshot:

The data in the database at a particular moment is called database state or extension, which
is the current set of instances. At the initial state of the database, the database state is said to
be empty.
Data model – a collection of concepts that can be used to describe the structure of DB.

Types of Data Model:


Hierarchical Model

Network Model

Entity-Relationship Model

Relational Model

Object-Oriented Data Model

Object-Relational Data Model

Flat Data Model


The list of the top 10 most popular RDBMSs are:

1.Oracle --Oracle Database is a relational database management system (RDBMS) developed by Oracle Corporation.

2.MySQL --MySQL is a free and open-source relational database management system (RDBMS)It was developed by Swedish company MySQL AB, which was later acquired by
Oracle Corporation.

3.SQL Server --SQL Server is a relational database management system (RDBMS) developed by Microsoft Corporation.

4.PostgreSQL --PostgreSQL is a free and open-source relational database management system (RDBMS) it was developed by active community of developers

5.IBM DB2 --IBM DB2 is a relational database management system (RDBMS) developed and marketed by IBM.

6.Microsoft Access --Microsoft Access is a relational database management system (RDBMS) that is part of the Microsoft Office suite of applications.

7.SQLite --SQLite is a popular open-source relational database management system (RDBMS) that is widely used in embedded systems, mobile devices, and desktop
applications.

8.MariaDB --MariaDB is an open-source relational database management system (RDBMS) that is a fork of the popular MySQL database system. developed by Oracle
Corporation.

9.Informix --nformix is a relational database management system (RDBMS) that is used for transaction processing and data warehousing developed by IBM

10.Azure SQL --Azure SQL is a cloud-based relational database service offered by Microsoft as part of their Azure cloud computing platform
Three schema Architecture
The three schema architecture is also called ANSI/SPARC architecture or three-
level architecture.

This framework is used to describe the structure of a specific database system.

The three schema architecture is also used to separate the user applications and
physical database.

The three schema architecture contains three levels. It breaks the database down
into three different categories.
The Three-Schema Architecture
The above diagram:

It shows the DBMS architecture.

Mapping is used to transform the request and response between various database levels of
architecture.

Mapping is not good for small DBMS because it takes more time.

In External / Conceptual mapping, it is necessary to transform the request from the external
level to the conceptual schema.

In Conceptual / Internal mapping, DBMS transforms the request from the conceptual to the
internal level.
The schemas are defined at three levels

Internal level or Physical level or Low level

Conceptual level or High level

External level or View level

Internal level:

It has an internal scheme, which describes the physical storage structure of the database by
means of different data structures link lists, queues, stacks, etc.

It uses a Physical data model.

It is useful for computer scientists.


Conceptual Level:
It has a conceptual schema, which describes the structure of the whole database.
It describes data as entities, attributes, & relationships.
It hides the details of physical storage structures.
It uses high-level data model or implementation data model.
It can be understood by end users.
External Level:
It includes a number of external schemas
It describes the part of the database that a particular user group is interested in and hides the
rest of the database from that group
It uses high-level data model or implementation data model.
It can be understood by end users.
Mappings: :

The three schemas are only descriptions of the database. The data is actually stored in the
database.

 If a particular user wants to retrieve data, he has to place a request at the external level.

The DBMS must transform this request specified on the external schema into a request
against the conceptual schema and then into a request on the internal schema for processing
over the stored database.

Hence, the retrieved data is reformatted and sent back to the user through the external view.

Thus, the processes of transforming requests and results between levels are called Mappings.
DATA INDEPENDENCE:
It is the capacity to change the schema at one level of a database system without having to
change at the next higher level. There are two types.
1. Logical data independence
2. Physical data independence

Logical data independence:

It is the capacity to change the conceptual schema without having to change the external
schema. Only the mappings between conceptual and external schema need to be changed.

Physical data independence:

It is the capacity to change the internal schema without having to change the conceptual
schema. Only the mappings between conceptual and internal schema need to be changed.
Data modeling using entity Relationship(ER) model
ENTITY- RELATIONSHIP MODEL (E-R MODEL)
The entity relationship model is a high-level conceptual model that is useful for end users.
An ER model describes data as
 Entities
 Attributes
 Relationships
Weak entity:

Entity types that do not have key attributes of their own are called weak entities.

Example:

Name, age

Strong entity:

Entities that do have a key attribute is called strong entity.

Example: employee, student, department, project.


Attributes:
Attributes are the properties that describe an entity . For example an employee
entity is described by the employee’s name, age, address, and salary.
A particular entity will have a value for each of its attributes.

Types of attributes:
• composite versus simple:

• multi-valued versus single-valued

• Stored versus derived


Composite attributes can be divided into smaller sub parts which represent more basic
attributes with independent meanings.
Examples: address, name of an employee
simple or atomic attributes
Attributes that are not divisible are called simple or atomic attributes.
Ex: age, sex
Multi-valued attributes have set of values for the same entity.
Example: college degrees attribute for a person, phone numbers.
Single valued attributes have single value for a particular entity.
Ex: age.
Derived attributes are derived from other attribute (stored attribute).
Ex: age attribute is derived from birth date attribute.
stored attribute : From which the value of other attributes are derived
 Age attribute is a derived attribute. date of birth (DOB) is a stored attribute.
Complex attributes are combination of composite attributes and multi-valued attributes. For
representing use ( ) for composite and { } for multi-valued.
Example: address
{Address (street address, city, state, pin code)}. Assume that a person can have more than one
residence.

Key attributes:
An entity type usually has an attribute whose values are distinct for each individual entity in
the collection. Such an attribute is called a key attribute and its values can be used to identify
each entity uniquely.
Example:
 Ssn of an employee entity, regno of a student entity, rollno of a student, dno of a department entity.
 An entity types can have more than one key attribute . For student entity regno, rollno both are key attributes
that uniquely identifies a student.
Relationships:

Whenever an attribute of one entity type refers to another entity type, some relationship exists
between entities.

Degree of relationship:

The degree of a relationship type is the number of participating entity types. In the works_for,
relationship that associates the employee and department entity the degree of relationship is
two. If the degree is, it is called a binary relationship, and one of degree three is called ternary.

Constraints on relationships:

•Relationship types usually have certain constraints that limit the possible combinations of
entities that may participate in the corresponding relationship set.

•There are two main types of relationship constraints:


• 1. Cardinality ratio:
• The cardinality ratio for a binary relationship specifies the number of
relationship instances that an entity can participate in.
• Example: in the WORKS_FOR binary relationship type, department: employee is of
cardinality ratio 1:N. (N stands for any number of related entities) means that each
department can be related to numerous employees.
• The possible cardinality ratios are 1: N, 1:1, M:N.

A 1:1 relationship, MANAGES.


An M:N relationship, WORKS_ON.
2. Participation.

There are two types.

Total participation:

The participation of employees in WORKS_FOR is called total participation meaning that


every entity in the total set of employees must be related to a department entity via
WORKS_FOR relationship.

Partial participation:

The participation of employee in manages relationship is called partial participation meaning


that the company do not expect each and every employee must be related to department entity.
Only some or part of the set of employees are related to department via manages relationship.
• Attributes of relationships:

Relationships can have attributes: example: the WORKS_ON relationship, which relates
employee and project, can have hours attribute to record the number of hours per week that

an employee works on a particular project.


ER DIAGRAM
ER diagrams for the COMPANY schema
ENHANCED ER MODEL
ENHANCED ER MODEL

 Today the complexity of the data is increasing so it becomes more and more difficult to use the traditional ER
model for database modeling.

 To reduce this complexity of modeling we have to make improvements or enhancements to the existing ER
model to make it able to handle the complex application in a better way.

 EER is a high-level data model that incorporates the extensions to the original ER model

 In addition to ER model concepts EE-R includes

 Generalization

 Specialization

 Aggregation
Features of EER Model

EER creates a design more accurate to database schemas.

It reflects the data properties and constraints more precisely.

It includes all modeling concepts of the ER model.

Diagrammatic technique helps for displaying the EER schema.

It includes the concept of specialization and generalizat ion.


Generalization
Generalization is a process of generalizing an entity which contains generalized attributes or
properties of generalized entities.

It is a Bottom up process i.e. consider we have 3 sub entities Car, Truck and Motorcycle.
Now these three entities can be generalized into one super class named as Vehicle.
Specialization
Specialization is a process of identifying subsets of an entity that share
some different characteristic.
It is a top down approach in which one entity is broken down into low
level entity.

In above example Vehicle entity can be a Car, Truck or


Motorcycle. In the above example, Employee can be specialized as Developer or
Tester, based on what role they play in an Organization .
The Relational Data Model
Relational Model
Relational model is an example of implementation model or representational model. An
implementation model provides concepts that may be understood by end users but that are not
too far removed from the way data is organized within the computer.
CONCEPTS:
The relational model represents database as a collection of relations.
 A relation is a table of values, and each row in the table represents a collection of related data
values.
In the relational model terminology a row is called a tuple,
 A column header is called an attribute.
The data type describing the types of values that can appear in each column is called a domain.
Example
Consider the RELATION: EMPLOYEE
NOTATIONS USED:
• A relation schema R, denoted by R (A1, A2, An), where R is the relation name.
• {A1, A2, An} the list of attributes of relation R.
• Dom. (Ai) denotes domain of Ai, represents the number of values in the attribute Ai.
• Degree of the relation is the number of attributes in the relation and denoted by n.
• Each tuple t is a list of values denoted by t = <v1, v2, vn > where each value vi is an element of dom(Ai) or is a
special value null.
• Null values represent attributes whose values are “unknown” or “value exists but not available” or “do not exist”.
• In our example, relation employee is represented as
• Employee (name, ssn, bdate, address, sex, salary, dno)
• Degree = 7
• A1 = name
• Dom(A1) = character
• First tuple {alex, 123, 12-07-76, M, 20000, 1}
• T (A1)= alex
Relational Database Constraints
Keys

Keys play an important role in the relational database.

It is used to uniquely identify any record or row of data from the table. It is also used to
establish and identify relationships between tables.

For example, ID is used as a key in the Student table because it is unique for each student.

In the PERSON table, passport_number, license_number, SSN are keys since they are unique
for each person.
RELATIONAL MODEL CONSTRAINTS:
Constraints are various restrictions or conditions on data that can be specified on a relational
database. These include

Domain constraints

Key constraints

Entity integrity constraints

Referential integrity constraints.


DOMAIN CONSTRAINTS:

Domain constraints specify that the value of each attribute A must be an atomic value from the
domain dom(A).

Atomic value means that it is not divisible into components

 Hence the composite and multi valued attributes are not allowed.

Multi valued attributes must be represented by separate relations, and composite attributes are
represented only by their simple component attributes.
KEY CONSTRAINTS

 No two tuples can have the same combination of values for all their attributes.

There must be at least one attribute, which identifies each tuple uniquely.

That attribute is called as key attribute.

 A relation may have more than one key and each of the keys is called a candidate key and any
one of the candidate keys is designated as a primary key.
ENTITY INTEGRITY CONSTRAINTS

The entity integrity constraint states that no primary key value can be null.

This is because the primary key value is used to identify individual tuples in a relation;

having null values for the primary key implies that we cannot identify some tuples.

 For example, regno field in the student relation cannot be null.

The primary key is one of the unique keys defined on a table,


It is selected to be the key of first importance.
There can be only one primary key on a table.
REFERENTIAL INTEGRITY CONSTRAINT:

A Foreign key is used to link tables together and create a relationship.


It is a field in one table that is linked to the primary key in another table

The Referential integrity constraint is specified between two relations and is used to maintain
the consistency among tuples of the relations.

 To define referential integrity more formally, we first define the concept of a foreign key.

 The foreign key specifies referential integrity constraints between the two relation schemas
R1 and R2.
Foreign key:

A set of attributes FK in relation schema R1 is a foreign key of R1 that references relation R2


if it satisfies the following two rules:

The attributes of FK of R1, PK of R2 should have the same domain.

A value of FK in a tuple t1 of R1 should exists as a value of PK for some tuple t2 of R2

R1 is called a referencing relation and R2 is called as referenced relation.

In our example, SSN is the primary key of employee relation and DNO is the primary key of
department relation.

The employee relation needs to refer the department relation hence we designate DNO as
foreign key of employee.
 The relational model for employee database is given below in that the primary keys are
underlined and referential integrity constraints are represented by, drawing directed arc
from each foreign key to the relation it references.

The arrowhead points to the primary key of referenced relation.


1. Primary key
It is the first key used to identify one and only one instance of an entity uniquely.

 An entity can contain multiple keys, as we saw in the PERSON table. The key which is most
suitable from those lists becomes a primary key.
2. Candidate key
`

A candidate key is an attribute or set of attributes that can uniquely identify a tuple.

Except for the primary key, the remaining attributes are considered a candidate key.

The candidate keys are as strong as the primary key.


3. Super Key
`

A super key is an attribute set that can uniquely identify a tuple. A super key is a superset of
a candidate key.

For example:
In the above EMPLOYEE table, for (EMPLOEE_ID, EMPLOYEE_NAME), the name of two employees can be the same, but their

EMPLYEE_ID can't be the same. Hence, this combination can also be a key .
4. Foreign key
`
 Foreign keys are the column of the table used to point to the primary key of another table.

 Every employee works in a specific department in a company, and employee and department are two different entities.

 So we can't store the department's information on the employee table.

 That's why we link these two tables through the primary key of one table.

 We add the primary key of the DEPARTMENT table, Department_Id, as a new attribute in the EMPLOYEE table.

 In the EMPLOYEE table, Department_Id is the foreign key, and both the tables are related.
5. Alternate key
`

 There may be one or more attributes or a combination of attributes that uniquely identify each tuple in a
relation.

 These attributes or combinations of the attributes are called the candidate keys.

 One key is chosen as the primary key from these candidate keys, and the remaining candidate key, if it exists,
is termed the alternate key.

For example, employee relation has two attributes, Employee_Id and PAN_No, that act as candidate keys. In this relation, Employee_Id is
chosen as the primary key, so the other candidate key, PAN_No, acts as the Alternate key.
6. Composite key
`

• Whenever a primary key consists of more than one attribute, it is known as a composite key. This key is also
known as Concatenated Key.
7. Artificial key
`

• The key created using arbitrarily assigned data is known as artificial key.

• These keys are created when a primary key is large and complex and has no relationship with many other
relations.

• The data values of the artificial keys are usually numbered in serial order.
RELATIONAL MODEL FOR COMPANY DATABASE
Referential integrity constraints displayed on the COMPANY relational database schema.
Naming Conventions
Naming Conventions
• Naming conventions are a set of guideline that make strong foundations for such a consistent system.
These guidelines ensure that the names of database entities are readable, easy to use in queries and do
not collide with names of other defined entities or keywords.
• NamingTables :
Tables represent a group/set of some entity that is usually a real-world object like an employee or
consequences of that entity like a project. Tables names are like nouns. Different teams of developers
follow different practices while naming their tables but some fundamentals are the key to efficiency.
There are following steps for the Naming table are as follows.
• Table names should be descriptive. If you are designing a table to store the data about customers in a
grocery shop then the table can be named “Customer” or “Customers” based on your preference
• NamingColumns :
Columns are different than tables as they can mean more than just a real-world entity. Columns
are the attributes that define a real-world entity. Columns may define the departure time of a train
or the distance of a planet from the sun, or simply someone’s name.
• Naming Primary Keys :
• Primary keys serve as the unique identifier for your table, thus it is important to be careful while naming them.
If several different tables with different uses have the same name for their respective primary key then it
would be very confusing.

• Make sure that instead of naming a primary key representing an identity number as ID, use domain-specific
names like StudentID or ID_Student.

• You can also use suffixes or prefixes with your primary keys to making them stand out from the general
column naming. For example, Coordinates_PK or PK_Coordinates.
• Naming Foreign Keys :
• Foreign keys are used as a bridge between two tables, and sometimes among more tables.
Thus, it is good to name your foreign key with the same name consistently throughout the
database to avoid any confusion.

• Similar to primary keys, you can add prefix or suffix to a foreign key name,
like RoomNo_fk or FK_RoomNo.

• At the end of the day, no one is going to force you to follow these conventions while
creating a database. But following even some of these will make your database better for
you as well as anyone else who might work on it in the future.
THE OBJECT ORIENTED DATABASES – INTRODUCTION
INTRODUCTION
• An object oriented database is a collection of objects defined by an object
oriented data model.

• An object oriented database can extend the existence of objects so that they are
stored permanently.

• Therefore, the objects persist beyond program termination and can be retrieved
later and shared by other programs
The Object oriented databases
An object-oriented database (OOD) is a database system that can work with complex
data objects — that is, objects that mirror those used in object-oriented programming
languages. In object-oriented programming (OOP), everything is an object.
• Object Database Definition

• An object database is managed by an object-oriented database management system


(OODBMS). The database combines object-oriented programming concepts with
relational database principles.

• Objects are the basic building block and an instance of a class, where the type is
either built-in or user-defined.

• Classes provide a schema or blueprint for objects, defining the behavior.

• Methods determine the behavior of a class.

• Pointers help access elements of an object database and establish relations between
objects.
• The main characteristic of objects in OODBMS is the possibility of user-
constructed types. An object created in a project or application saves into a
database as is.

• Object-oriented databases directly deal with data as complete objects. All the
information comes in one instantly available object package instead of multiple
tables.

• In contrast, the basic building blocks of relational databases, such as


PostgreSQL or MySQL, are tables with actions based on logical connections
between the table data.
These characteristics make object databases suitable for projects with complex data which require an object-oriented
approach to programming. An object-oriented management system provides supported functionality catered to object-
oriented programming where complex objects are central. This approach unifies attributes and behaviors of data into one
entity.
Object-Oriented Programming Concepts
• Object-oriented databases closely relate to object-oriented programming
concepts. The four main ideas of object-oriented programming are:
• Polymorphism
• Inheritance
• Encapsulation
• Abstraction
• These four attributes describe the critical characteristics of object-oriented
management systems.
• Polymorphism
• Polymorphism is the capability of an object to take multiple forms. This ability allows the same program
code to work with different data types. Both a car and a bike are able to break, but the mechanism is different.
In this example, the action break is a polymorphism. The defined action is polymorphic — the result changes

depending on which vehicle performs.


• Inheritance
• Inheritance creates a hierarchical relationship between related classes while making parts of code reusable.
Defining new types inherits all the existing class fields and methods plus further extends them. The existing
class is the parent class, while the child class extends the parent.

• For example, a parent class called Vehicle will have child classes Car and Bike. Both child
classes inherit information from the parent class and extend the parent class with new information depending

on the vehicle type.


• Encapsulation

• Encapsulation is the ability to group data and mechanisms into a single object to provide
access protection. Through this process, pieces of information and details of how an object
works are hidden, resulting in data and function security. Classes interact with each other
through methods without the need to know how particular methods work.
• Abstraction

• Abstraction is the procedure of representing only the essential data features


for the needed functionality. The process selects vital information while
unnecessary information stays hidden. Abstraction helps reduce the
complexity of modeled data and allows reusability.
• For example, there are different ways for a computer to connect to the
network. A web browser needs an internet connection. However, the
connection type is irrelevant. An established connection to the internet
represents an abstraction, whereas the various types of connections represent
different implementations of the abstraction.
Weakness of RDBMS
• What is RDBMS?

• Introduction:
• RDBMS stands for Relational Database management system.
• It is relational model in which data is stored in multiple tables where tables are
related to each other using primary keys and foreign keys and indexes.
• RDBMS uses database normalization techniques to avoid redundancy in tables.
It helps to fetch data faster using SQL query.
• It is widely used by enterprises and software developers to store large amount
of complex data.
• Examples: SQL server, Oracle, MySQL, MariaDB, SQLite
• Benefits or advantages of RDBMS

• Following are the benefits or advantages of RDBMS:


➨It is easy to use.
➨It is secured in nature.
➨The data manipulation can be done.
➨It limits redundancy and replication of the data.
➨It offers better data integrity.
➨It provides better physical data independence.
➨It offers logical database independence i.e. data can be viewed in different ways by the different
users.
➨It provides better backup and recovery procedures.
➨It provides multiple interfaces.
➨Multiple users can access the database which is not possible in DBMS.
Drawbacks or disadvantages of RDBMS
• Following are the disadvantages of RDBMS:
➨Software is expensive.
➨Complex software refers to expensive hardware and hence increases overall cost to
avail the RDBMS service.
➨It requires skilled human resources to implement.
➨Certain applications are slow in processing.
➨It is difficult to recover the lost data.
Next Generation Database Systems
NewSQL – Next-generation databases
• NewSQL – Next-generation databases Such databases deliver SQL
compatibility and ACID compliance, which is often missing from NoSQL
databases, with the scalability and flexibility needed for speedy transaction
processing.
• When people use the term “NoSQL database,” they typically use it to refer
to any non-relational database.
• Some say the term “NoSQL” stands for “non SQL” while others say it stands
for “not only SQL.”
• Either way, most agree that NoSQL databases are databases that store data in a
format other than relational tables.
SQL vs NO SQL vs NEW SQL

• SQL stands for Structured Query Language. Which is based on relational algebra and
schema is fixed in this which means data is stored in the form of columns and tables.

• SQL follows ACID properties which means Atomicity, Consistency, Isolation, and
Durability are maintained.

• There are three types of languages present in SQL :

Data Definition Language

Data Manipulation Language


Examples:
Data Control Language Commercial: Oracle, IBM
Open Source: Mysql
NoSQL - “not only SQL”, “non-SQL”,
• NoSQL, also referred to as “not only SQL”, “non-SQL”, is an approach to database design
that enables the storage and querying of data outside the traditional structures found in
relational databases.
• NoSql stands for no-SQL which can be related to non-relational.
• In a NoSQL database storage and retrieval of data done in other than tabular relations are used
in relational databases therefore it is schema-free.
• NoSQL is also an open-source and distributed type of database.
There are four categories depending on the type of data model they support:
• Document Stores
• Graph Database
• Wide Column Databases
• Key-value stores
• Examples: Cassandra, MongoDB, CouchDB
NewSQL
• NewSQL is a modern relational database whose goal is to combine ACID guarantees of
SQL with the scalability and high performance of NoSQL.
• It is made using modern programming languages and technology that wasn’t available
before.
• Examples: VoltDB, Clustrix
Object Oriented Data Models
The Object-Oriented Model
The Object-Oriented Model in DBMS or OODM is the data model where data is stored in
the form of objects.

This model is used to represent real-world entities.

The data and data relationship is stored together in a single entity known as an object in the

Object Oriented Model.


Object and class
• Object-oriented data models are a way of organizing and structuring data that is based on
the principles of object-oriented programming (OOP).

• In these models, data is represented as objects, which are instances of classes.

• This approach allows for a more natural and intuitive representation of data, making it easier

to model complex real-world systems and relationships.

Objects
Classes
Inheritance
Encapsulation
Polymorphism
Association
Aggregation and Composition
• Objects: Objects are instances of classes and represent individual entities or
concepts in the data model. Each object has attributes (also called properties or
fields) that describe its characteristics and methods (functions) that define its
behavior.

• Classes: Classes are blueprints or templates that define the structure and
behavior of objects. They specify what attributes an object of that class can
have and what methods can be called on those objects. Classes can inherit
attributes and methods from other classes through inheritance.
• Inheritance: Inheritance is a fundamental concept in OOP that allows one
class to inherit attributes and methods from another class. This enables the
creation of hierarchies and specialization of classes. Subclasses inherit
properties and behaviors from their parent classes and can also add new
attributes and methods or override existing ones.

• Encapsulation: Encapsulation is the concept of bundling data (attributes) and


the methods (functions) that operate on that data into a single unit called an
object. It enforces data hiding, which means that the internal details of an
object are hidden from the outside world, and interactions with the object occur
through well-defined interfaces (public methods).
• Polymorphism: Polymorphism allows objects of different classes to be treated
as objects of a common superclass. This enables code to be written that can
work with objects of different types in a consistent way. Polymorphism is
typically achieved through method overriding and interfaces (in languages like
Java) or through dynamic typing (in languages like Python).

• Association: Association represents relationships between objects. Objects can


be associated with each other in various ways, such as one-to-one, one-to-
many, or many-to-many relationships. These associations are often represented
as attributes in the classes.
• Polymorphism: Polymorphism allows objects of different classes to be treated
as objects of a common superclass. This enables code to be written that can
work with objects of different types in a consistent way. Polymorphism is
typically achieved through method overriding and interfaces (in languages like
Java) or through dynamic typing (in languages like Python).

• Association: Association represents relationships between objects. Objects can


be associated with each other in various ways, such as one-to-one, one-to-
many, or many-to-many relationships. These associations are often represented
as attributes in the classes.
• Object-oriented data models are commonly used in software engineering and database
design to model complex systems and represent data in a way that closely mirrors the
real world.

• Some programming languages, such as Java and C++, are designed with built-in
support for OOP, making it easier to implement object-oriented data models in
software applications.

Persistence – Issues in OODBMS
Persistence –in OODBMS
 Persistent objects are stored permanently in the secondary storage of object-oriented databases. These
persistent data and objects are shared across various applications and programs.

 An object-oriented database management system (OODBMS) offers computer-generated, unique object


identifiers to access each object

 There are two methods that the OODBMS uses to access persistent objects, virtual memory address pointers,
and hash tables. A persistent object will always be ready to be invoked, and its state can and will be preserved
and survive any kind of system failure. Remember, persistent objects are stored on disk and transient objects
exist in RAM memory. In an OODBMS, an object may traverse between states.

 Persistent means that the object has been saved to the database whereas transient means that it hasn't been
saved yet. So for example when you get an entity from a repository, that entity is persistent. When you create
a new entity, it is transient until persisted.
Object Oriented Database Management System Manifesto
Advantages and Disadvantages of OODBMS
Object Database
• Object Database is referred to as Object-oriented database (OODB) and the
database system is referred to as Object-oriented database management
system (ODBMS/OODBMS)

• ODBMS is the data model in which data is stored in form of objects, which are
instances of classes.

• These classes and objects together make an object-oriented data model

123
RDBMS and OODBMS
BASIS RDBMS OODBMS
Stands for Relational Database
Long Form Stands for Object Oriented Database Management System
Management System

Stores data in Entities, defined as tables


Way of storing data Stores data as Objects
hold specific information

Data Complexity Handles comparatively simpler data Handles larger and complex data than RDBMS

Entity type refers to the collection of entity Class describes a group of objects that have common
Grouping
that share a common definition relationships, behaviors, and also have similar properties

Data Handling RDBMS stores only data Stores data as well as methods to use it

Data Independence from application


Main Objective Data Encapsulation
program

A Primary key distinctively identifies an An object identifier (OID) is an unambiguous, long-term name for
Key
object in a table any type of object or entity

124
Object Database
Reasons for creation of Object Oriented Databases
•Need for more complex applications
•Need for additional data modeling features
•Increased use of object-oriented programming languages

125
What Is An Object In DBMS
• A database object is any defined object in a database that is used to store or reference
data . Anything which we make from create command is known as Database Object.

• It can be used to hold and manipulate the data. Some of the examples of database
objects are : view, sequence, indexes, etc.

126
Components of Object-Oriented Data Model
• Objects – User defined complex data types
• An object has structure or state (variables)
and methods (behavior/operations)
An object is described by four characteristics
• Identifier: a system-wide unique id for an
object
• Name: an object may also have a unique
name in DB (optional)
• Lifetime: determines if the object is
persistent or transient
• Structure: Construction of objects using
type constructors

127
Components of ODBMS
• There are three major components
1.Object structure
2.Object classes
3.Object identity

128
Components of ODBMS
Object Structure
•The structure of an object refers to the properties that an object is
made up of. These properties of an object are referred to as an
attribute
•Thus, an object is a real-world entity with certain attributes that
makes up the object structure
•Also, an object encapsulates the data code into a single unit which in
turn provides data abstraction by hiding the implementation details
from the user

129
Components of ODBMS
Object Structure
•The object structure is further composed of three types of components: Messages,
Methods, and Variables
• Messages
• A message provides an interface or acts as a communication medium between an
object and the outside world
• A message can be of two types:
• Read-only message: If the invoked method does not change the value of a variable,
then the invoking message is said to be a read-only message
• Update message: If the invoked method changes the value of a variable, then the
invoking message is said to be an update message

130
Components of ODBMS
Object Structure
•Methods
•When a message is passed then the body of code that is executed is
known as a method
• Whenever a method is executed, it returns a value as output. A
method can be of two types:
• Read-only method: When the value of a variable is not affected by
a method, then it is known as the read-only method
• Update-method: When the value of a variable change by a
method, then it is known as an update method

131
Components of ODBMS
Object Structure
•Variables
•It stores the data of an object. The data stored in the
variables makes the object distinguishable from one another

132
Components of ODBMS
Object Classes
•An object which is a real-world entity is an instance of a class.
Hence first we need to define a class and then the objects are
made which differ in the values they store but share the same
class definition
•The objects in turn correspond to various messages and
variables stored in them

133
Components of ODBMS
Object Classes
class CLERK
{ //variables
char name;
string address;
int id;
int salary;
//methods
char get_name();
string get_address();
int annual_salary();
};
In the above example code, we can see, CLERK is a class that holds the object
variables and messages

134
Components of ODBMS
Object Identity
•One goal of an ODBMS is to maintain a direct correspondence between real-world
and database objects so that objects do not lose their integrity and identity and
can easily be identified and operated
•Hence it provides a unique system generated identity to each independent object
stored in the database known as object identifier (OID)
•The value of an OID is not visible to the external user, but is used internally by the
system to identify each object uniquely and to create and manage inter-object
references
•The OID is immutable, OID should be used only once for an object and cannot be
assigned to another object even it is removed from the database
135
Characteristics of ODBMS
• Easy to link with programming language: The programming language
and the database schema use the same type definitions, so there is
no need to learn a new database query language
• No need for user defined keys: ODBMS have an automatically
generated OID associated with each of the objects
• Easy modeling: ODBMS can easily model real-world objects, hence,
are suitable for applications with complex data
• Can store non-textual data: ODBMS can also store audio, video and
image data

136
Advantages of ODBMS
• Speed: Access to data can be faster because an object can be
retrieved directly without a search, by following pointers
• Improved performance: These systems are most suitable for
applications that use object oriented programming
• Extensibility: Unlike traditional RDBMS where the basic-datatypes are
hardcoded, when using ODBMS the user can encode any kind of data
structures to hold the data

137
Advantages of ODBMS
• Data consistency: When ODBMS is integrated with an object-based
application, there is much greater consistency between the database
and the programming language since both use the same model of
representation for the data. This helps avoid the impedance
mismatch
• Capability of handling variety of data: Unlike other database
management systems, ODBMS can also store non textual data like-:
images, videos and audios

138
Disadvantages of ODBMS
• No universal standards: There is no universally agreed standards of operating
ODBMS. This the most significant drawback as the user is free to manipulate data
model as he wants which can be an issue when handling enormous amounts of
data
• No security features: Since use of ODBMS is very limited, there are not adequate
security features to store production-grade data
• Exponential increase in complexity: ODBMS become very complex very fast. When
there is a lot of data and a lot of relations between data, managing and optimizing
ODBMS becomes difficult
• Scalability: Unable to support large systems
• Query optimization is challenging: Optimizing ODBMS queries requires complete
information about the data like-: type and size of data
139

You might also like