0% found this document useful (0 votes)
5 views

Unit 1(dbms)

Uploaded by

gnimish175
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Unit 1(dbms)

Uploaded by

gnimish175
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 66

What is Data?

is data” is that data is different types of information usually formatted in a


particular manner. All software is divided into two major categories: programs
and data. We already know what data is now, and programs are collections of
instructions used to manipulate data.

We use data science to make it easier to work with data. Data science is defined
as a field that combines knowledge of mathematics, programming skills,
domain expertise, scientific methods, algorithms, processes, and systems to
extract actionable knowledge and insights from both structured and
unstructured data, then apply the knowledge gleaned from that data to a wide
range of uses and domains.

What is Information?

Information is defined as classified or organized data that has some meaningful


value for the user. Information is also the processed data used to make decisions
and take action. Processed data must meet the following criteria for it to be of
any significant use in decision-making:

 Accuracy: The information must be accurate.


 Completeness: The information must be complete.
 Timeliness: The information must be available when it’s needed.

Types and Uses of Data

Growth in the field of technology, specifically in smartphones has led to text,


video, and audio is included under data plus the web and log activity records as
well. Most of this data is unstructured.

The term Big Data is used in the data definition to describe the data that is in
the petabyte range or higher. Big Data is also described as 5Vs: variety, volume,
value, veracity, and velocity. Nowadays, web-based eCommerce has spread
vastly, business models based on Big Data have evolved, and they treat data as
an asset itself. And there are many benefits of Big Data as well, such as reduced
costs, enhanced efficiency, enhanced sales, etc.
The meaning of data has grown beyond the processing of data in the field of
computer applications. For instance, we’ve already touched upon what data
science is. Accordingly, finance, demographics, health, and marketing also
have different definitions of data, which ultimately results in different answers
to the persistent question, “What is data?”

How is Data Stored?

Computers represent data (e.g., text, images, sound, video), as binary values
that employ two numbers: 1 and 0. The smallest unit of data is called a “bit,”
and it represents a single value. Additionally, a byte is eight bits long. Memory
and storage are measured in units such as megabytes, gigabytes, terabytes,
petabytes, and exabytes. Data scientists keep coming up with newer, larger data
measurements as the amount of data our society generates continues to grow.

Data can be stored in file formats using mainframe systems such as ISAM and
VSAM, though there are other file formats for data conversion, processing, and
storage, like comma-separated values. These data formats are currently used
across a wide range of machine types, despite more structured-data-oriented
approaches gaining a greater foothold in today’s IT world.

The field of data storage has seen greater specialization develop as the database,
the database management system, and more recently, relational database
technology, each made their debut and provided new ways to organize
information.

What is Database

The database is a collection of inter-related data which is used to retrieve, insert


and delete the data efficiently. It is also used to organize the data in the form of
a table, schema, views, and reports, etc.

For example: The college Database organizes the data about the admin, staff,
students and faculty etc.

Using the database, you can easily retrieve, insert, and delete the information.

Database Management Systems (DBMS) are software systems used to store,


retrieve, and run queries on data. A DBMS serves as an interface between an
end-user and a database, allowing users to create, read, update, and delete data
in the database.
DBMS manage the data, the database engine, and the database schema,
allowing for data to be manipulated or extracted by users and other programs.
This helps provide data security, data integrity, concurrency, and uniform data
administration procedures.
DBMS optimizes the organization of data by following a database schema
design technique called normalization, which splits a large table into smaller
tables when any of its attributes have redundancy in values. DBMS offer
many benefits over traditional file systems, including flexibility and a more
complex backup system.
Database management systems can be classified based on a variety of criteria
such as the data model, the database distribution, or user numbers. The most
widely used types of DBMS software are relational, distributed, hierarchical,
object-oriented, and network.

1. Database management system is a software which is used to manage the


database. For example: MySQL
a. , Oracle
b. , etc are a very popular commercial database which is used in different
applications.

2. DBMS provides an interface to perform various operations like database


creation, storing data in it, updating data, creating a table in the database
and a lot more.
3. It provides protection and security to the database. In the case of multiple
users, it also maintains data consistency.

DBMS allows users the following tasks:

o Data Definition: It is used for creation, modification, and removal of


definition that defines the organization of data in the database.
o Data Updation: It is used for the insertion, modification, and deletion
of the actual data in the database.
o Data Retrieval: It is used to retrieve the data from the database which
can be used by applications for various purposes.
o User Administration: It is used for registering and monitoring users,
maintain data integrity, enforcing data security, dealing with
concurrency control, monitoring performance and recovering
information corrupted by unexpected failure.

Types of Database Language

1. Data Definition Language


o DDL stands for Data Definition Language. It is used to define database
structure or pattern.
o It is used to create schema, tables, indexes, constraints, etc. in the
database.
o Using the DDL statements, you can create the skeleton of the database.
o Data definition language is used to store the information of metadata like
the number of tables and schemas, their names, indexes, columns in each
table, constraints, etc.

Here are some tasks that come under DDL:

o Create: It is used to create objects in the database.


o Alter: It is used to alter the structure of the database.
o Drop: It is used to delete objects from the database.
o Truncate: It is used to remove all records from a table.
o Rename: It is used to rename an object.
o Comment: It is used to comment on the data dictionary.
These commands are used to update the database schema that's why they come
under Data definition language.

2. Data Manipulation Language

DML stands for Data Manipulation Language. It is used for accessing and
manipulating data in a database. It handles user requests.

Here are some tasks that come under DML:

o Select: It is used to retrieve data from a database.


o Insert: It is used to insert data into a table.
o Update: It is used to update existing data within a table.
o Delete: It is used to delete all records from a table.
o Merge: It performs UPSERT operation, i.e., insert or update operations.
o Call: It is used to call a structured query language or a Java subprogram.
o Explain Plan: It has the parameter of explaining data.
o Lock Table: It controls concurrency.

3. Data Control Language


o DCL stands for Data Control Language. It is used to retrieve the stored
or saved data.
o The DCL execution is transactional. It also has rollback parameters.

(But in Oracle database, the execution of data control language does not
have the feature of rolling back.)

Here are some tasks that come under DCL:

o Grant: It is used to give user access privileges to a database.


o Revoke: It is used to take back permissions from the user.

There are the following operations which have the authorization of Revoke:

CONNECT, INSERT, USAGE, EXECUTE, DELETE, UPDATE and


SELECT.

4. Transaction Control Language

TCL is used to run the changes made by the DML statement. TCL can be
grouped into a logical transaction.
Here are some tasks that come under TCL:

o Commit: It is used to save the transaction on the database.


o Rollback: It is used to restore the database to original since the last
Commit.

Application of DBMS
Sector Application
Universities Student information, courses, grades, etc.
Sales Customer information, sales, etc.
Finance Stock information, sales, bonds, etc.
Banking Customer information, account, activities, deposits, loans,
etc.
Manufacturing Production information, suppliers, inventories, etc.
Airlines Customer information, schedules, reservations, etc.
HR Management Employee information, payroll, deduction, paychecks, etc.
Telecommunication Call records, bills, usage, etc.

Characteristics of DBMS

o It uses a digital repository established on a server to store and manage


the information.
o It can provide a clear and logical view of the process that manipulates
data.
o DBMS contains automatic backup and recovery procedures.
o It contains ACID properties which maintain data in a healthy state in case
of failure.
o It can reduce the complex relationship between data.
o It is used to support manipulation and processing of data.
o It is used to provide security of data.
o It can view the database from different viewpoints according to the
requirements of the user.

 Provides security and removes redundancy


 Self-describing nature of a database system
 Insulation between programs and data abstraction
 Support of multiple views of the data
 Sharing of data and multiuser transaction processing
 Database Management Software allows entities and relations among
them to form tables.
 It follows the ACID concept ( Atomicity, Consistency, Isolation, and
Durability).
 DBMS supports multi-user environment that allows users to access and
manipulate data in parallel.
 Data Integrity: Data Integrity is maintained in a Database Management
System. This means that the structure of the database can change, but the
application that uses the data does not have to change.
 Data Consistency: Data Consistency is also maintained in a Database
Management System. The data is identical regardless of who is
inspecting it.
 Data Backups: Backing up data from a single location is simple.
 Data Security: In DBMSs, Data is housed in a secure central location,
and many access privileges can be assigned to multiple people.
 Customization of Applications: Applications can be tailored to meet
the specific needs of the user without having to change the database.
 Data Accessibility: One of the main benefits of a Database Management
System is that the same business data can be made available to various
personnel at any time and from any location. A database management
system (DBMS) allows multiple users to access information that is
accessible remotely and twenty-four hours a day, seven days a week.

Data Redundancy or Data Duplication is Minimized: In a database


management system, information is kept concise and only appears once
to avoid data unpredictability. This is done using a technique called
Normalization

 Data Management Made Simple: Another benefit of database


management software is that it facilitates data management by providing
users with easy yet powerful tools for entering, changing, and exporting
corporate data. Through data customization, Database Management
System also decreases individual users’ reliance on computer specialists
and programmers to satisfy their specific demands.

No Dependency on Any Programming Language: Yet another benefit


of Database Management Systems is that it is independent of any type of
programming language. This means that one does not have to know any
specific programming language in order to access a Database
Management System. Writing SQL or NoSQL queries would be
sufficient irrespective of what

o
Advantages of DBMS

o Controls database redundancy: It can control data redundancy because


it stores all the data in one single database file and that recorded data is
placed in the database.
o Data sharing: In DBMS, the authorized users of an organization can
share the data among multiple users.
o Easily Maintenance: It can be easily maintainable due to the centralized
nature of the database system.
o Reduce time: It reduces development time and maintenance need.
o Backup: It provides backup and recovery subsystems which create
automatic backup of data from hardware

and software

failures and restores the data if required.

o multiple user interface: It provides different types of user interfaces


like graphical user interfaces, application program interfaces

Disadvantages of DBMS

o Cost of Hardware and Software: It requires a high speed of data


processor and large memory size to run DBMS software.
o Size: It occupies a large space of disks and large memory to run them
efficiently.
o Complexity: Database system creates additional complexity and
requirements.
o Higher impact of failure: Failure is highly impacted the database
because in most of the organization, all the data stored in a single
database and if the database is damaged due to electric failure or database
corruption then the data may be lost forever.

ACID Properties in DBMS

A transaction is a single logical unit of work which accesses and possibly


modifies the contents of a database. Transactions access data using
read and write operations. In order to maintain consistency in a database,
before and after the transaction, certain properties are followed. These are
called ACID properties.
Atomicity
By this, we mean that either the entire transaction takes place at once or
doesn’t happen at all. There is no midway i.e. transactions do not occur
partially. Each transaction is considered as one unit and either runs to
completion or is not executed at all. It involves the following two operations.
—Abort: If a transaction aborts, changes made to database
are not visible.
—Commit: If a transaction commits, changes made are
visible. Atomicity is also known as the ‘All or nothing rule’.

Consider the following transaction T consisting of T1 and T2: Transfer

of 100 from account X to account Y.


If the transaction fails after completion of T1 but before completion
of T2.( say, after write(X) but before write(Y)), then amount has been
deducted from X but not added to Y. This results in an inconsistent database
state. Therefore, the transaction must be executed in entirety in order to ensure
correctness of database state.

Consistency
This means that integrity constraints must be maintained so that the database
is consistent before and after the transaction. It refers to the correctness of a
database. Referring to the example above, The total amount before and after
the transaction must be maintained.

Total before T occurs = 500 + 200 =


700. Total after T occurs = 400 + 300
= 700.

Therefore, database is consistent. Inconsistency occurs in case T1


completes but T2 fails. As a result T is incomplete.

Isolation
This property ensures that multiple transactions can occur concurrently
without leading to the inconsistency of database state. Transactions occur
independently without interference. Changes occurring in a particular
transaction will not be visible to any other transaction until that particular
change in that transaction is written to memory or has been committed. This
property ensures that the execution of transactions concurrently will result in
a state that is equivalent to a state achieved these were executed
serially in some order. Let X= 500, Y = 500.

Consider two transactions T and T”.

Suppose T has been executed till Read (Y) and then T’’ starts. As a result ,
interleaving of operations takes place due to which T’’ reads correct value of
X but incorrect value of Y and sum computed by

T’’: (X+Y = 50, 000+500=50, 500)


is thus not consistent with the sum at end of transaction:
T: (X+Y = 50, 000 + 450 = 50, 450).

This results in database inconsistency, due to a loss of 50 units. Hence,


transactions must take place in isolation and changes should be visible only
after they have been made to the main memory.

Durability:
This property ensures that once the transaction has completed execution, the
updates and modifications to the database are stored in and written to disk and
they persist even if a system

Types of Databases

There are various types of databases used for storing different varieties of data:

1) Centralized Database

It is the type of database that stores data at a centralized database system. It


comforts the users to access the stored data from different locations through
several applications. These applications contain the authentication process to let
users access data securely. An example of a Centralized database can be Central
Library that carries a central database of each library in a college/university.

Advantages of Centralized Database


o It has decreased the risk of data management, i.e., manipulation of data will
not affect the core data.
o Data consistency is maintained as it manages data in a central repository.
o It provides better data quality, which enables organizations to establish
data standards.
o It is less costly because fewer vendors are required to handle the data sets.

Disadvantages of Centralized Database


o The size of the centralized database is large, which increases the response
time for fetching the data.
o It is not easy to update such an extensive database system.
o If any server failure occurs, entire data will be lost, which could be a huge
loss.

2) Distributed Database

Unlike a centralized database system, in distributed systems, data is distributed


among different database systems of an organization. These database systems are
connected via communication links. Such links help the end-users to access the
data easily. Examples of the Distributed database are Apache Cassandra, HBase,
Ignite, etc.

We can further divide a distributed database system into:

3.6M

Meta, Epic Games, Microsoft and Others Team Up To Develop Metaverse


Standards
o Homogeneous DDB: Those database systems which execute on the same
operating system and use the same application process and carry the same
hardware devices.
o Heterogeneous DDB: Those database systems which execute on different
operating systems under different application procedures, and carries
different hardware devices.

Advantages of Distributed Database


o Modular development is possible in a distributed database, i.e., the system
can be expanded by including new computers and connecting them to the
distributed system.
o One server failure will not affect the entire data set.

3) Relational Database

This database is based on the relational data model, which stores data in the form
of rows(tuple) and columns(attributes), and together forms a table(relation). A
relational database uses SQL for storing, manipulating, as well as maintaining the
data. E.F. Codd invented the database in 1970. Each table in the database carries
a key that makes the data unique from others. Examples of Relational databases
are MySQL, Microsoft SQL Server, Oracle, etc.

Properties of Relational Database

There are following four commonly known properties of a relational model


known as ACID properties, where:
A means Atomicity: This ensures the data operation will complete either with
success or with failure. It follows the 'all or nothing' strategy. For example, a
transaction will either be committed or will abort.

C means Consistency: If we perform any operation over the data, its value
before and after the operation should be preserved. For example, the account
balance before and after the transaction should be correct, i.e., it should remain
conserved.

I means Isolation: There can be concurrent users for accessing data at the same
time from the database. Thus, isolation between the data should remain isolated.
For example, when multiple transactions occur at the same time, one transaction
effects should not be visible to the other transactions in the database.

D means Durability: It ensures that once it completes the operation and commits
the data, data changes should remain permanent.

4) NoSQL Database

Non-SQL/Not Only SQL is a type of database that is used for storing a wide range
of data sets. It is not a relational database as it stores data not only in tabular form
but in several different ways. It came into existence when the demand for building
modern applications increased. Thus, NoSQL presented a wide variety of
database technologies in response to the demands. We can further divide a
NoSQL database into the following four types:
a. Key-value storage: It is the simplest type of database storage where it
stores every single item as a key (or attribute name) holding its value, together.
b. Document-oriented Database: A type of database used to store data as
JSON-like document. It helps developers in storing data by using the same
document-model format as used in the application code.
c. Graph Databases: It is used for storing vast amounts of data in a graph-
like structure. Most commonly, social networking websites use the graph
database.
d. Wide-column stores: It is similar to the data represented in relational
databases. Here, data is stored in large columns together, instead of storing
in rows.

Advantages of NoSQL Database


o It enables good productivity in the application development as it is not
required to store data in a structured format.
o It is a better option for managing and handling large data sets.
o It provides high scalability.
o Users can quickly access data from the database through key-value.

5) Cloud Database

A type of database where data is stored in a virtual environment and executes


over the cloud computing platform. It provides users with various cloud
computing services (SaaS, PaaS, IaaS, etc.) for accessing the database. There are
numerous cloud platforms, but the best options are:

o Amazon Web Services(AWS)


o Microsoft Azure
o Kamatera
o PhonixNAP
o ScienceSoft
o Google Cloud SQL, etc.

6) Object-oriented Databases

The type of database that uses the object-based data model approach for storing
data in the database system. The data is represented and stored as objects which
are similar to the objects used in the object-oriented programming language.

7) Hierarchical Databases
It is the type of database that stores data in the form of parent-children relationship
nodes. Here, it organizes data in a tree-like structure.

Data get stored in the form of records that are connected via links. Each child
record in the tree will contain only one parent. On the other hand, each parent
record can have multiple child records.

8) Network Databases

It is the database that typically follows the network data model. Here, the
representation of data is in the form of nodes connected via links between them.
Unlike the hierarchical database, it allows each record to have multiple children
and parent nodes to form a generalized graph structure.

9) Personal Database

Collecting and storing data on the user's system defines a Personal Database. This
database is basically designed for a single user.

Advantage of Personal Database


o It is simple and easy to handle.
o It occupies less storage space as it is small in size.

10) Operational Database


The type of database which creates and updates the database in real-time. It is
basically designed for executing and handling the daily data operations in several
businesses. For example, An organization uses operational databases for
managing per day transactions.

11) Enterprise Database

Large organizations or enterprises use this database for managing a massive


amount of data. It helps organizations to increase and improve their efficiency.
Such a database allows simultaneous access to users.

Advantages of Enterprise Database:


o Multi processes are supportable over the Enterprise database.
o It allows executing parallel queries on the system.

Introduction of Information processing systems

An information system is essentially made up of five components hardware,


software, database, network and people. These five components integrate to
perform input, process, output, feedback and control.
Hardware consists of input/output device, processor, operating system and media
devices. Software consists of various programs and procedures. Database consists
of data organized in the required structure. Network consists of hubs,
communication media and network devices. People consist of device operators,
network administrators and system specialist.
Information processing consists of input; data process, data storage, output and
control. During input stage data instructions are fed to the systems which during
process stage are worked upon by software programs and other queries. During
output stage, data is presented in structured format and reports.

Types of Information System

The types of information systems are as follows:


1. Transaction Processing System (TPS):
o The term "transaction processing system" refers to an information system
that processes data are originating from business transactions.
o The primary purpose of a transaction processing system is to offer
transactions to update records and produce reports required for
storekeeping.
o Online Transaction Processing and Batching Processing are the methods
which we used to complete the transaction.
o Examples of transaction processing systems are Stock control systems,
Payroll systems, Bill systems.

2. Management Information System (MIS):


o The purpose of a management information system is to transform
comparatively raw data accessible through using Transaction Processing
System into a summarized and aggregated form for managers, generally in
the form of a report. Operational supervisors and middle management are
likely to use the reports.
o In MIS, there are various kinds of reports generated. Few reports are a kind
of summary report, ad-hoc reports, exception report, and on-demand
report.
o Examples of Management Information System are Human resource
management system and Sales management systems.

3. Decision Support System (DSS)


o Another type of information system is a decision support system. It is
interactive, which offers information, data manipulation tools, and models
to support decision-making in a semi-structured and unstructured scenario.
o This type of information system includes tools and techniques to help
gather relevant information and examine options, and substitutes, the end-
user being more elaborate in making DSS than MIS.
o Examples of Decision Support System: Bank loan management systems,
financial planning systems.

4. Experts System
o The expert system contains expertise which is helpful for a manager
in identifying problems or in problem-solving. The principles of artificial
intelligence research are used to develop these kinds of information
systems.
o This type of information system is a knowledge-based system. It acts as an
expert consultant to users by utilizing its knowledge of a specific area.
o There are some components of expert systems such as Knowledgebase and
software modules. These modules make inferences based on knowledge
and provide answers to a user's query.

Components of Information System

There are various components of an information system:

1. Hardware
2. Software
3. Data
4. Procedures
5. People
6. Feedback

Let's discuss the above components in detail:

1. Hardware

Hardware means equipment and machinery. This category encompasses the


computer and all of its supporting equipment in modern information systems. The
supporting devices contain input and output devices, communication devices and
storage device. Hardware in pre-computer information systems may contain
ledger books and ink.
2. Software

In an information system, software means computer programs as well as the


manuals which support them. Computer program means the machine-readable
instructions that tell circuitry in the system's hardware to work to generate helpful
information from the data. In most cases, programs are stored on an input/output
medium, such as a tape or disk. The software which is for pre-computer
information systems comprised instruction for using them means the guidebook
for a card catalog and the information regarding how the hardware was
configured for use such as columns headings in the ledger book.

3. Data

Data means facts that systems use to generate valuable knowledge. Data is usually
stored in machine-readable form on tape or disk until the computer requires them.
The data in pre-computer information systems is usually stored in a human-
readable format.

4. Procedures

Procedures mean rules which govern how an operation is performed in


information system. "Procedures are for people what software is for hardware" is
a general analogy that we used to clarify the importance of procedures in a
system.

5. People

Every system requires individuals if the system is to be beneficial. People are


often the most neglected part of the system, and they are possibly the factor that
has the greatest impact on the success or failure of information systems.

Advantages of Information System

There are various advantages of the information system:

o Communication
o Availability
o Creation of new types of jobs
o Globalization and cultural gap
Communication

Using information technology, instant messaging, emails, voice, and video calls,
communication become inexpensive, faster, and effective.

Availability

With the help of the Information system, it is possible for businesses around the
world to be open around the clock. This implies that a business can be open
anytime, anyplace, making buys from various nations simpler and more helpful.
It likewise implies that you can have your products delivered right to your
doorstep without making more effort.

Creation of New Types of Jobs

The creation of new and exciting jobs is another advantage of the information
system. We can create various opportunities using IT such as computer
programmers, Hardware and Software developers, Web designers, and Systems
analyzers.

Globalization and Cultural Gap

We may reduce semantic, Geological, and some social constraints by


implementing an information system. Sharing data, information, knowledge,
communication, and connections between different nations, societies, and
dialects are a lot easier.
There are the following differences between DBMS and File systems:

Basis DBMS Approach File System Approach

Meaning DBMS is a collection of data. In The file system is a collection of


DBMS, the user is not required to data. In this system, the user has
write the procedures. to write the procedures for
managing the database.

Sharing of data Due to the centralized approach, Data is distributed in many files,
data sharing is easy. and it may be of different formats,
so it isn't easy to share data.

Data DBMS gives an abstract view of The file system provides the
Abstraction data that hides the details. detail of the data representation
and storage of data.

Security and DBMS provides a good protection It isn't easy to protect a file under
Protection mechanism. the file system.

Recovery DBMS provides a crash recovery The file system doesn't have a
Mechanism mechanism, i.e., DBMS protects the crash mechanism, i.e., if the
user from system failure. system crashes while entering
some data, then the content of the
file will be lost.

Manipulation DBMS contains a wide variety of The file system can't efficiently
Techniques sophisticated techniques to store store and retrieve the data.
and retrieve the data.

Concurrency DBMS takes care of Concurrent In the File system, concurrent


Problems access of data using some form of access has many problems like
locking. redirecting the file while deleting
some information or updating
some information.
Where to use Database approach used in large File system approach used in
systems which interrelate many large systems which interrelate
files. many files.

Cost The database system is expensive to The file system approach is


design. cheaper to design.

Data Due to the centralization of the In this, the files and application
Redundancy and database, the problems of data programs are created by different
Inconsistency redundancy and inconsistency are programmers so that there exists
controlled. a lot of duplication of data which
may lead to inconsistency.

Structure The database structure is complex The file system approach has a
to design. simple structure.

Data In this system, Data Independence In the File system approach, there
Independence exists, and it can be of two types. exists no Data Independence.

o Logical Data Independence


o Physical Data Independence

Integrity Integrity Constraints are easy to Integrity Constraints are difficult


Constraints apply. to implement in file system.

Data Models In the database approach, 3 types of In the file system approach, there
data models exist: is no concept of data models
exists.
o Hierarchal data models
o Network data models
o Relational data models

Flexibility Changes are often a necessity to the The flexibility of the system is
content of the data stored in any less as compared to the DBMS
system, and these changes are more approach.
easily with a database approach.
Examples Oracle, SQL Server, Sybase etc. Cobol, C++ etc.

What is RDBMS?

RDBMS stands for Relational Database Management System. It is an information


management system that is oriented on a data model. Here all the information is
properly stored as tables. RDBMS Example systems are SQL Server, Oracle,
MySQL, MariaDB, and SQLite.

Basic Features of RDBMS:

 Offers information to be saved in the tables


 Numerous users can access it together which is managed by a single user
 Virtual tables are available for storing the insightful data
 In order to exclusively find out the rows, the primary key is used
 The data are always saved in rows and columns
 To retrieve the information the indexes are used
 Columns are being shared between tables using the keys

RDBMS CONCEPTS
RDBMS stands for Relational Database Management System. RDBMS is the
basis for SQL, and for all modern database systems like MS SQL Server, IBM
DB2, Oracle, MySQL, and Microsoft Access.
A Relational database management system (RDBMS) is a database management
system (DBMS) that is based on the relational model as introduced by E. F. Codd.

Relation in the RDBMS is the deposit of tuples having similar characteristics. A


relation in RDBMS means the set of the entities and data contained in them. The
entities are different instances and their relation is organized in different rows and
columns in the data table. The related information is of identical domains and
constraints. By deleting old data and by inserting new data, relations are altered
in the database model.

Domain in RDBMS

The domain describes probable terms collected jointly that always have the same
characteristics and also constraints. A domain can be involved in a feature but
only if the feature is a factor of a particular set.

RDBMS Database

The association between different databases is called the relational database. Here
all the data are related in terms of the tables they are stored in. The users will be
able to access them. RDBMS database is different from that of DBMS.

The RDBMS speaks about relations between different entities present in the
database. Normal Database assists only the tables while RDBS along with the
tables tells their connections too. Normal databases give consistent methods but
databases of RDBMS do not offer any methodologies but instead give
connections that connect one single object with another.

The stored database is called executable code. The database collects and saves
data and that particular procedure is called the stored procedure. During this, the
codes are also stored which are used for encapsulation, delete, etc. The
programmers are able to add extensions of the syntaxes of SQL due to the
applications of the APIs in the stored processes.

Constraints

Constraints are sort of limitations functional to the database. They make available
the way to employ the trade logic and the regulations in the database. In the
database, it can be applied in the type of confirming limits that verify the set of
laws that the developer has missed. The constraint is also restricting the facts that
can be saved in the relations. They are applied to verify the province’s
performance and to keep it protected.

The Main Principles Of The RDBMS Model are:

 Entity integrity: The entity integrity says that in a database, all the data
should be organized having a single key. The uniqueness of all the data is
maintained by this principle.
 Referential integrity: Referential integrity means that in the database all
table values stay true for all foreign keys.

RDBMS Operators

There are several relational operators that perform on the RDBMS. They are:

 The Union operator mingles the rows of 2 relations and ignores the
replacement. It also takes out the copied ones from the output.
 The intersection operator gives a collection of rows that is identical to two
relations.
 The difference operator gives the result by having 2 relations and gives the
difference of rows from the first that don’t exist in the second.
 Cartesian product is done on two relations. It works as a cross join operator.

Benefits of relational database management system

The simple yet powerful relational model is used by organizations of all types
and sizes for a broad variety of information needs. Relational databases are used
to track inventories, process ecommerce transactions, manage huge amounts of
mission-critical customer information, and much more. A relational database
can be considered for any information need in which data points relate to each
other and must be managed in a secure, rules-based, consistent way.

Relational databases have been around since the 1970s. Today, the advantages
of the relational model continue to make it the most widely accepted model for
databases.
ACID properties and RDBMS

Four crucial properties define relational database transactions: atomicity,


consistency, isolation, and durability—typically referred to as ACID.

 Atomicity defines all the elements that make up a complete database


transaction.
 Consistency defines the rules for maintaining data points in a correct
state after a transaction.
 Isolation keeps the effect of a transaction invisible to others until it is
committed, to avoid confusion.
 Durability ensures that data changes become permanent once the
transaction is committed.

What is a table?

The data in an RDBMS is stored in database objects which are called as tables.
This table is basically a collection of related data entries and it consists of
numerous columns and rows.
Remember, a table is the most common and simplest form of data storage in a
relational database. The following program is an example of a CUSTOMERS
table −
+----+----------+-----+-----------+----------+
| ID | NAME | AGE | ADDRESS | SALARY |
+----+----------+-----+-----------+----------+
| 1 | Ramesh | 32 | Ahmedabad | 2000.00 |
| 2 | Khilan | 25 | Delhi | 1500.00 |
| 3 | kaushik | 23 | Kota | 2000.00 |
| 4 | Chaitali | 25 | Mumbai | 6500.00 |
| 5 | Hardik | 27 | Bhopal | 8500.00 |
| 6 | Komal | 22 | MP | 4500.00 |
| 7 | Muffy | 24 | Indore | 10000.00 |
+----+----------+-----+-----------+----------+

What is a field?

Every table is broken up into smaller entities called fields. The fields in the
CUSTOMERS table consist of ID, NAME, AGE, ADDRESS and SALARY.
A field is a column in a table that is designed to maintain specific information
about every record in the table.
What is a Record or a Row?

A record is also called as a row of data is each individual entry that exists in a
table. For example, there are 7 records in the above CUSTOMERS table.
Following is a single row of data or record in the CUSTOMERS table −
+----+----------+-----+-----------+----------+
| 1 | Ramesh | 32 | Ahmedabad | 2000.00 |
+----+----------+-----+-----------+----------+
A record is a horizontal entity in a table.

What is a column?

A column is a vertical entity in a table that contains all information associated


with a specific field in a table.
For example, a column in the CUSTOMERS table is ADDRESS, which
represents location description and would be as shown below −
+-----------+
| ADDRESS |
+-----------+
| Ahmedabad |
| Delhi |
| Kota |
| Mumbai |
| Bhopal |
| MP |
| Indore |
+----+------+

Difference between DBMS and RDBMS

Although DBMS and RDBMS both are used to store information in physical
database but there are some remarkable differences between them.

The main differences between DBMS and RDBMS are given below:

No. DBMS RDBMS


1) DBMS applications store data as RDBMS applications store data in a tabular
file. form.

2) In DBMS, data is generally stored In RDBMS, the tables have an identifier called
in either a hierarchical form or a primary key and the data values are stored in the
navigational form. form of tables.

3) Normalization is not present in Normalization is present in RDBMS.


DBMS.

4) DBMS does not apply any RDBMS defines the integrity constraint for the
security with regards to data purpose of ACID (Atomocity, Consistency,
manipulation. Isolation and Durability) property.

5) DBMS uses file system to store in RDBMS, data values are stored in the form of
data, so there will be no relation tables, so a relationship between these data
between the tables. values will be stored in the form of a table as well.

6) DBMS has to provide some RDBMS system supports a tabular structure of


uniform methods to access the the data and a relationship between them to
stored information. access the stored information.

7) DBMS does not support RDBMS supports distributed database.


distributed database.

8) DBMS is meant to be for small RDBMS is designed to handle large amount of


organization and deal with small data. it supports multiple users.
data. it supports single user.

9) Examples of DBMS are file Example of RDBMS are mysql, postgre, sql
systems, xml etc. server, oracle etc.
Types of DBMS Architecture

Database management systems are divided into multiple levels of abstraction for
proper functioning. These modules/layers describe the functioning and the design
of the DBMS.
Since a database management system is not always directly accessible by the user
or an application, we can maintain it with the help of various architectures based
on how the user is connected to the database. These architectures follow a tier-
based classification, i.e., the DBMS architecture is classified depending upon
how many layers are present in the structure of the DBMS.
Hence, an n-tier DBMS Architecture divides the whole DBMS into related
but n independent layers or levels, i.e., a one-tier architecture divides the
DBMS into a single layer, a two-tier DBMS architecture divides the DBMS into
two layers, a three-tier in three layers, and so on. When the layers are increased
in the architecture, the level of abstraction also increases, resulting in an increase
in the security and the complexity of the DBMS structure. All these layers are
independent, i.e., any modification performed in a particular layer does not affect
the other layer present in the architecture.
Now, let’s look at the most common DBMS architectures:

 Single Tier Architecture (One-Tier Architecture)


 Two-Tier Architecture
 Three-Tier Architecture
1. Single Tier Architecture
Single Tier DBMS Architecture is the most straightforward DBMS architecture.
All the DBMS components reside on a single server or platform, i.e., the
database is directly accessible by the end-user. Because of this direct
connection, the DBMS provides a rapid response, due to which programmers
widely use this architecture to enhance the local application.
In this structure, any modifications done by the client are reflected directly in
the database, and all the processing is done on a single server. Also, no network
connection is required to perform actions on the database. This database
management system is also known as the local database system.

Single Tier DBMS Architecture is used whenever:

 The data isn't changed frequently.


 No multiple users are accessing the database system.
 We need a direct and simple way to modify or access the database for
application development.

Example of Single Tier DBMS Architecture:


In order to learn the Structure Query Language (SQL), we set up our SQL
server and the database on our local system. This SQL server enables us to
directly interact with the relational database and execute certain operations
without requiring any network connection. This whole setup to learn SQL
queries is an example of Single-Tier DBMS architecture.
Highlights:
1- Simplest DBMS architecture.
2- All the components of DBMS, i.e., the server, database, and client, reside on
a single system.
3- The user can directly access the database.
4- Used when data isn't changing frequently.
5- Suitable for programmers, database designers, and single-user access.

2. Two Tier Architecture


Two-Tier DBMS Architecture is similar to the fundamental concept of client-
server architecture. In a two-tier structure, the server provides the database
functionality and it allows the clients to perform operations on the database
through a direct internet connection via APIs (Application Programming
Interface), for example:

 ODBC: Open Database Connectivity.


 JDBC: Java Database Connectivity.

The Two-Tier DBMS Architecture is used when we wish to access the DBMS
with the help of an application. Client-side applications can access the database
server directly with the help of API calls, making the application independent of
the database in terms of operation, design, and programming.

The main advantages of having a two-tier architecture over a single tier are:

 Multiple users can use it at the same time. Hence, it can be used in an
organization.
 It has high processing ability as the database functionality is handled by
the server alone.
 Faster access to the database due to the direct connection and improved
performance.
 Because of the two independent layers, it's easier to maintain.

Example of Two Tier DBMS Architecture:


Consider a situation where you went to a bank to withdraw some cash. After
entering the withdrawal amount and the account details on the withdrawal slip,
the banker will go through the server-side database via his credential (API call)
and will check whether there is enough balance present or not. This client-
server model is an example of Two-Tier DBMS architecture.

Note -main disadvantages of Two-Tier DBMS Architecture are:

 Scalability - As the number of clients increases, the load on the server


increases. Thereby declining the performance of the DBMS and, in turn,
the client-side application.
 Security - The Direct connection between the client and server systems
makes this architecture vulnerable to attacks.

Highlights:
1- Similar to a client-server architecture.
2- Faster access, Easier to maintain, and can handle multiple users
simultaneously.
3-Used when we wish to access DBMS via applications and APIs.
4-Has scalability and security issues because of direct client-server connection.
4. Three Tier Architecture

Three-Tier DBMS Architecture is the most widely used DBMS architecture in


which another layer known as Intermediate or Application layer is added
between the server (Database Layer) and the client (Presentation Layer)
systems to reduce the query processing load of the server. This application or
intermediate layer provides the end-user an abstract view of the database.
Since there is no direct connection between the client and the Server, all the user
requests are handled by the Application Layer, i.e., the requests sent by the users
are checked and verified by the Intermediate Layer before transferring them to
the server. This reduces the query processing load from the server and enhances
the security of the overall DBMS design as the client can't communicate directly
with the database server. Hence, the application layer is responsible for load
balancing, query request correctness, and security in Three-Tier DBMS
Architecture.

The main advantages of Three Tier DBMS Architecture are:

 Scalability - Since the database server isn't aware of any users beyond
the application layer and the application layer implements load balancing,
there can be as many clients as you want.
 Data Integrity - Data corruption and bad requests can be avoided
because of the checks performed in the application layer on each client
reques.
 Security - The removal of the direct connection between the client and
server systems via abstraction reduces unauthorized access to the
database.
 Disadvantages:
Increased complexity of implementation and communication. It
becomes difficult for this sort of interaction to take place due to the
presence of middle layers.

Note - In Three Tier DBMS Architecture, an additional layer (Application


Layer) is added between the Client and the Server. This increases the number of
layers present between the DBMS and the end-users, making the
implementation of the DBMS structure complex and difficult to maintain.
Highlights:
1- Most widely used DBMS architecture.
2- Follows Client-Application-Server architecture.
3- Enhanced security, data integrity, and scalability.
4-Has complexity and maintenance issues because of the extra layer.
-------------------------------------------------------------------------------------

DBMS Architecture
o The DBMS design depends upon its architecture. The basic client/server
architecture is used to deal with a large number of PCs, web servers,
database servers and other components that are connected with networks.
o The client/server architecture consists of many PCs and a workstation
which are connected via the network.
o DBMS architecture depends upon how users are connected to the database
to get their request done.

Types of DBMS Architecture


Database architecture can be seen as a single tier or multi-tier. But logically,
database architecture is of two types like: 2-tier architecture and 3-tier
architecture.

1-Tier Architecture
o In this architecture, the database is directly available to the user. It means
the user can directly sit on the DBMS and uses it.
o Any changes done here will directly be done on the database itself. It
doesn't provide a handy tool for end users.
o The 1-Tier architecture is used for development of the local application,
where programmers can directly communicate with the database for the
quick response.

2-Tier Architecture
o The 2-Tier architecture is same as basic client-server. In the two-tier
architecture, applications on the client end can directly communicate with
the database at the server side. For this interaction, API's
like: ODBC, JDBC are used.
o The user interfaces and application programs are run on the client-side.
o The server side is responsible to provide the functionalities like: query
processing and transaction management.
o To communicate with the DBMS, client-side application establishes a
connection with the server side.
Fig: 2-tier Architecture

3-Tier Architecture
o The 3-Tier architecture contains another layer between the client and
server. In this architecture, client can't directly communicate with the
server.
o The application on the client-end interacts with an application server which
further communicates with the database system.
o End user has no idea about the existence of the database beyond the
application server. The database also has no idea about any other user
beyond the application.
o The 3-Tier architecture is used in case of large web application.
Fig: 3-tier Architecture

--------------------------------------------------------------------------------------------

Three schema Architecture


o The three schema architecture is also called ANSI/SPARC architecture or
three-level architecture.
o This framework is used to describe the structure of a specific database
system.
o The three schema architecture is also used to separate the user applications
and physical database.
o The three schema architecture contains three-levels. It breaks the database
down into three different categories.

The three-schema architecture is as follows:


In the above diagram:

o It shows the DBMS architecture.


o Mapping is used to transform the request and response between various
database levels of architecture.
o Mapping is not good for small DBMS because it takes more time.
o In External / Conceptual mapping, it is necessary to transform the request
from external level to conceptual schema.
o In Conceptual / Internal mapping, DBMS transform the request from the
conceptual to internal level.
Three schema Architecture

The main objective of three level architecture is to enable multiple users to access
the same data with a personalized view while storing the underlying data only
once. Thus it separates the user's view from the physical structure of the database.
This separation is desirable for the following reasons:

o Different users need different views of the same data.


o The approach in which a particular user needs to see the data may change
over time.
o The users of the database should not worry about the physical
implementation and internal workings of the database such as data
compression and encryption techniques, hashing, optimization of the
internal structures etc.
o All users should be able to access the same data according to their
requirements.
o DBA should be able to change the conceptual structure of the database
without affecting the user's
o Internal structure of the database should be unaffected by changes to
physical aspects of the storage.

1. Internal Level

o The internal level has an internal schema which describes the physical
storage structure of the database.
o The internal schema is also known as a physical schema.
o It uses the physical data model. It is used to define that how the data will
be stored in a block.
o The physical level is used to describe complex low-level data structures in
detail.

The internal level is generally is concerned with the following activities:

45.2M

769

History of Java

o Storage space allocations.


For Example: B-Trees, Hashing etc.
o Access paths.
For Example: Specification of primary and secondary keys, indexes,
pointers and sequencing.
o Data compression and encryption techniques.
o Optimization of internal structures.
o Representation of stored fields.

2. Conceptual Level

o The conceptual schema describes the design of a database at the conceptual


level. Conceptual level is also known as logical level.
o The conceptual schema describes the structure of the whole database.
o The conceptual level describes what data are to be stored in the database
and also describes what relationship exists among those data.
o In the conceptual level, internal details such as an implementation of the
data structure are hidden.
o Programmers and database administrators work at this level.

3. External Level

o At the external level, a database contains several schemas that sometimes


called as subschema. The subschema is used to describe the different view
of the database.
o An external schema is also known as view schema.
o Each view schema describes the database part that a particular user group
is interested and hides the remaining database from that user group.
o The view schema describes the end user interaction with database systems.

Mapping between Views

The three levels of DBMS architecture don't exist independently of each other.
There must be correspondence between the three levels i.e. how they actually
correspond with each other. DBMS is responsible for correspondence between
the three types of schema. This correspondence is called Mapping.

There are basically two types of mapping in the database architecture:

o Conceptual/ Internal Mapping


o External / Conceptual Mapping

Conceptual/ Internal Mapping

The Conceptual/ Internal Mapping lies between the conceptual level and the
internal level. Its role is to define the correspondence between the records and
fields of the conceptual level and files and data structures of the internal level.

External/ Conceptual Mapping

The external/Conceptual Mapping lies between the external level and the
Conceptual level. Its role is to define the correspondence between a particular
external and the conceptual view.
Advantages of Three-schema Architecture
Following are the advantages of three schema architecture:

 This architecture makes the database abstract. It is used to hide the details
of how data is physically stored in a computer system, which makes it
easier to use for a user.
 This architecture allows each user to access the same database with a
different customized view of data.
 This architecture enables a database admin to change the storage structure
of the database without affecting the user currently on the system.

DBMS - Data Models


Data models define how the logical structure of a database is modeled. Data
Models are fundamental entities to introduce abstraction in a DBMS. Data models
define how data is connected to each other and how they are processed and stored
inside the system.
The very first data model could be flat data-models, where all the data used are
to be kept in the same plane. Earlier data models were not so scientific, hence
they were prone to introduce lots of duplication and update anomalies.
Data Model gives us an idea that how the final system will look like after its
complete implementation. It defines the data elements and the relationships
between the data elements. Data Models are used to show how data is stored,
connected, accessed and updated in the database management system. Here, we
use a set of symbols and text to represent the information so that members of
the organisation can communicate and understand it. Though there are many
data models being used nowadays but the Relational model is the most widely
used model. Apart from the Relational model, there are many other types of data
models about which we will study in details in this blog. Some of the Data
Models in DBMS are:

Entity Relationship model:-

Entity-Relationship Model or simply ER Model is a high-level data model


diagram. In this model, we represent the real-world problem in the pictorial form
to make it easy for the stakeholders to understand. It is also very easy for the
developers to understand the system by just looking at the ER diagram. We use
the ER diagram as a visual tool to represent an ER Model. ER diagram has the
following three components:

 Entities: Entity is a real-world thing. It can be a person, place, or even a


concept. Example: Teachers, Students, Course, Building, Department, etc
are some of the entities of a School Management System.
 Attributes: An entity contains a real-world property called attribute. This
is the characteristics of that attribute. Example: The entity teacher has the
property like teacher id, salary, age, etc.
 Relationship: Relationship tells how two attributes are
related. Example: Teacher works for a department.
Example:

In the above diagram, the entities are Teacher and Department. The attributes
of Teacher entity are Teacher_Name, Teacher_id, Age, Salary,
Mobile_Number. The attributes of entity Department entity are Dept_id,
Dept_name. The two entities are connected using the relationship. Here, each
teacher works for a department.

Features of ER Model
 Graphical Representation for Better Understanding: It is very easy and
simple to understand so it can be used by the developers to communicate
with the stakeholders.
 ER Diagram: ER diagram is used as a visual tool for representing the
model.
 Database Design: This model helps the database designers to build the
database and is widely used in database design.
Advantages of ER Model

 Simple: Conceptually ER Model is very easy to build. If we know the


relationship between the attributes and the entities we can easily build the
ER Diagram for the model.
 Effective Communication Tool: This model is used widely by the
database designers for communicating their ideas.
 Easy Conversion to any Model: This model maps well to the relational
model and can be easily converted relational model by converting the ER
model to the table. This model can also be converted to any other model
like network model, hierarchical model etc.
Disadvatages of ER Model

 No industry standard for notation: There is no industry standard for


developing an ER model. So one developer might use notations which are
not understood by other developers.
 Hidden information: Some information might be lost or hidden in the ER
model. As it is a high-level view so there are chances that some details of
information might be hidden.

Types of Entity type

 Strong Entity Type


 Weak Entity Type
Strong Entity Type: Strong entity are those entity types which has a key
attribute. The primary key helps in identifying each entity uniquely. It is
represented by a rectangle. In the above example, Roll_no identifies each
element of the table uniquely and hence, we can say that STUDENT is a
strong entity type.
Weak Entity Type: Weak entity type doesn't have a key attribute. Weak entity
type can't be identified on its own. It depends upon some other strong entity
for its distinct identity. This can be understood with a real-life example. There
can be children only if the parent exits. There can be no independent existence
of children. There can be a room only if building exits. There can be no
independent existence of a room. A weak entity is represented by a double
outlined rectangle. The relationship between a weak entity type and strong
entity type is called an identifying relationship and shown with a double
outlined diamond instead of a single outlined diamond. This representation can
be seen in the diagram below.

Example: If we have two tables of Customer(Customer_id, Name, Mobile_no,


Age, Gender) and Address(Locality, Town, State, Customer_id). Here we
cannot identify the address uniquely as there can be many customers from the
same locality. So, for this, we need an attribute of Strong Entity Type i.e
‘Customer’ here to uniquely identify entities of 'Address' Entity Type.
Entity Set
Entity Set is a collection of entities of the same entity type. In the above
example of STUDENT entity type, a collection of entities from the Student
entity type would form an entity set. We can say that entity type is a
superset of the entity set as all the entities are included in the entity
type. Let's try to understand this with the help of an example.

Example 1: In the below example, two entities E1 (2, Angel, 19, 8709054568)
and E2(4, Analisa, 21, 9847852156) form an entity set.
Example 2: We can form another entity set by taking three entities from the
table. (2, Angel, 19, 8709054568) , (3, Priya, 20, 9864257315) and (4,
Analisa, 21, 9847852156) can also form a entity set. Similary, we can form
any combination of the entity set using any of the entities from the entity type
'STUDENT'. Also, we can understand that if we take all the records to the
entity set we get the entity type 'STUDENT'. So, we can say that the entity type
is the superset of the entity set.

This is all about an entity, entity type and entity set. Hope you learned the
difference between these terms.

Types of Attributes in ER Model


An attribute is a property or characteristic of an entity. An entity may contain
any number of attributes. One of the attributes is considered as the primary
key. In an Entity-Relation model, attributes are represented in an elliptical
shape.
Example: Student has attributes like name, age, roll number, and many more.
To uniquely identify the student, we use the primary key as a roll number as it
is not repeated. Attributes can also be subdivided into another set of attributes.
There are five such types of attributes: Simple, Composite, Single-valued,
Multi-valued, and Derived attribute. One more attribute is their, i.e. Complex
Attribute, this is the rarely used attribute.
Simple attribute :
An attribute that cannot be further subdivided into components is a simple
attribute.
Example: The roll number of a student, the id number of an employee.
Composite attribute :
An attribute that can be split into components is a composite attribute.
Example: The address can be further split into house number, street number,
city, state, country, and pin code, the name can also be split into first name
middle name, and last name.
Single-valued attribute :
The attribute which takes up only a single value for each entity instance is a
single-valued attribute.
Example: The age of a student.
Multi-valued attribute :
The attribute which takes up more than a single value for each entity instance
is a multi-valued attribute.
Example: Phone number of a student: Landline and mobile.
Derived attribute :
An attribute that can be derived from other attributes is derived attributes.
Example: Total and average marks of a student.
Complex attribute :
Those attributes, which can be formed by the nesting of composite and multi-
valued attributes, are called “Complex Attributes“. These attributes
are rarely used in DBMS(DataBase Management System). That’s why they are
not so popular.

Relational Model
Relational Model is the most widely used model. In this model, the data is
maintained in the form of a two-dimensional table. All the information is stored
in the form of row and columns. The basic structure of a relational model is
tables. So, the tables are also called relations in the relational
model. Example: In this example, we have an Employee table.
Features of Relational Model

 Tuples: Each row in the table is called tuple. A row contains all the
information about any instance of the object. In the above example, each
row has all the information about any specific individual like the first row
has information about John.
 Attribute or field: Attributes are the property which defines the table or
relation. The values of the attribute should be from the same domain. In
the above example, we have different attributes of the employee like
Salary, Mobile_no, etc.
Advnatages of Relational Model

 Simple: This model is more simple as compared to the network and


hierarchical model.
 Scalable: This model can be easily scaled as we can add as many rows
and columns we want.
 Structural Independence: We can make changes in database structure
without changing the way to access the data. When we can make changes
to the database structure without affecting the capability to DBMS to
access the data we can say that structural independence has been
achieved.
Disadvantages of Relatinal Model
 Hardware Overheads: For hiding the complexities and making things
easier for the user this model requires more powerful hardware computers
and data storage devices.
 Bad Design: As the relational model is very easy to design and use. So
the users don't need to know how the data is stored in order to access it.
This ease of design can lead to the development of a poor database which
would slow down if the database grows.
But all these disadvantages are minor as compared to the advantages of the
relational model. These problems can be avoided with the help of proper
implementation and organisation.

. Relationship

A relationship is used to describe the relation between entities. Diamond or


rhombus is used to represent the relationship.

Types of relationship are as follows:

a. One-to-One Relationship

When only one instance of an entity is associated with the relationship, then it is
known as one to one relationship.

For example, A female can marry to one male, and a male can marry to one
female.

b. One-to-many relationship
When only one instance of the entity on the left, and more than one instance of
an entity on the right associates with the relationship then this is known as a one-
to-many relationship.

For example, Scientist can invent many inventions, but the invention is done by
the only specific scientist.

c. Many-to-one relationship

When more than one instance of the entity on the left, and only one instance of
an entity on the right associates with the relationship then it is known as a many-
to-one relationship.

For example, Student enrolls for only one course, but a course can have many
students.

d. Many-to-many relationship

When more than one instance of the entity on the left, and more than one instance
of an entity on the right associates with the relationship then it is known as a
many-to-many relationship.

For example, Employee can assign by many projects and project can have many
employees.
Difference between a database and a relational database

Relational Database Database

A relational database can store and arrange the data in the It is used to store the data as files
tabular form like rows and columns.

The data normalization feature is available in the relational It does not have a normalization.
database.

It supports a distributed database. It does not support the distribute

In a relational database, the values are stored as tables that Generally, it stores the data in
require a primary keys to possess the data in a database. navigational form.

It is designed to handle a huge collection of data and It is designed to handle the smal
multiple users. files that requires a single user.

A relational database uses integrity constraints rules that It does not follow any integrity c
are defined in ACID properties. utilize any security to protec
manipulation.

Stored data can be accessed from the relational database There is no relationship between
because there is a relationship between the tables and their stored in files.
attributes.
Advantages of relational databases
1. Simple Model: The simplest model of the relational database does not
require any complex structure or query to process the databases. It has a
simple architectural process as compared to a hierarchical database
structure. Its simple architecture can be handled with simple SQL queries
to access and design the relational database.
2. Data Accuracy: Relational databases can have multiples tables related to
each other through primary and foreign keys. There are fewer chances for
duplication of data fields. Therefore the accuracy of data in relational
database tables is greater than in any other database system.
3. Easy to access Data: The data can be easily accessed from the relational
database, and it does not follow any pattern or way to access the data. One
can access any data from a database table using SQL queries. Each table in
the associated database is joined through any relational queries such as join
and conditional descriptions to concatenate all tables to get the required
data.
4. Security: It sets a limit that allows specific users to use relational data in
RDBMS.
5. Collaborate: It allows multiple users to access the same database at a time.

Object-Oriented Data Model


The real-world problems are more closely represented through the object-
oriented data model. In this model, both the data and relationship are present in
a single structure known as an object. We can store audio, video, images, etc in
the database which was not possible in the relational model(although you can
store audio and video in relational database, it is adviced not to store in the
relational database). In this model, two are more objects are connected through
links. We use this link to relate one object to other objects. This can be
understood by the example given below.
In the above example, we have two objects Employee and Department. All the
data and relationships of each object are contained as a single unit. The attributes
like Name, Job_title of the employee and the methods which will be performed
by that object are stored as a single object. The two objects are connected
through a common attribute i.e the Department_id and the communication
between these two will be done with the help of this common id.

Hierarchical Model
Hierarchical Model was the first DBMS model. This model organises the data
in the hierarchical tree structure. The hierarchy starts from the root which has
root data and then it expands in the form of a tree adding child node to the parent
node. This model easily represents some of the real-world relationships like
food recipes, sitemap of a website etc. Example: We can represent the
relationship between the shoes present on a shopping website in the following
way:
Features of a Hierarchical Model

1. One-to-many relationship: The data here is organised in a tree-like


structure where the one-to-many relationship is between the datatypes.
Also, there can be only one path from parent to any node. Example: In
the above example, if we want to go to the node sneakers we only have
one path to reach there i.e through men's shoes node.
2. Parent-Child Relationship: Each child node has a parent node but a
parent node can have more than one child node. Multiple parents are not
allowed.
3. Deletion Problem: If a parent node is deleted then the child node is
automatically deleted.
4. Pointers: Pointers are used to link the parent node with the child node
and are used to navigate between the stored data. Example: In the above
example the 'shoes' node points to the two other nodes 'women shoes' node
and 'men's shoes' node.
Advantages of Hierarchical Model

 It is very simple and fast to traverse through a tree-like structure.


 Any change in the parent node is automatically reflected in the child node
so, the integrity of data is maintained.
Disadvantages of Hierarchical Model

 Complex relationships are not supported.


 As it does not support more than one parent of the child node so if we
have some complex relationship where a child node needs to have two
parent node then that can't be represented using this model.
 If a parent node is deleted then the child node is automatically deleted.

Network Model
This model is an extension of the hierarchical model. It was the most popular
model before the relational model. This model is the same as the hierarchical
model, the only difference is that a record can have more than one parent. It
replaces the hierarchical tree with a graph. Example: In the example below we
can see that node student has two parents i.e. CSE Department and Library. This
was earlier not possible in the hierarchical model.

Features of a Network Model

1. Ability to Merge more Relationships: In this model, as there are more


relationships so data is more related. This model has the ability to manage
one-to-one relationships as well as many-to-many relationships.
2. Many paths: As there are more relationships so there can be more than
one path to the same record. This makes data access fast and simple.
3. Circular Linked List: The operations on the network model are done with
the help of the circular linked list. The current position is maintained with
the help of a program and this position navigates through the records
according to the relationship.
Advantages of Network Model

 The data can be accessed faster as compared to the hierarchical model.


This is because the data is more related in the network model and there
can be more than one path to reach a particular node. So the data can be
accessed in many ways.
 As there is a parent-child relationship so data integrity is present. Any
change in parent record is reflected in the child record.
Disadvantages of Network Model

 As more and more relationships need to be handled the system might get
complex. So, a user must be having detailed knowledge of the model to
work with the model.
 Any change like updation, deletion, insertion is very complex.

What is Data Independence of DBMS?


Data Independence is defined as a property of DBMS that helps you to change
the Database schema at one level of a database system without requiring to
change the schema at the next higher level. Data independence helps you to
keep data separated from all programs that make use of it.

You can use this stored data for computing and presentation. In many systems,
data independence is an essential function for components of the system.

Types of Data Independence


In DBMS there are two types of data independence

1. Physical data independence


2. Logical data independence.

Levels of Database
Before we learn Data Independence, a refresher on Database Levels is
important. The database has 3 levels as shown in the diagram below

1. Physical/Internal
2. Conceptual
3. External

Physical Data Independence


Physical data independence helps you to separate conceptual levels from the
internal/physical levels. It allows you to provide a logical description of the
database without the need to specify physical structures. Compared to Logical
Independence, it is easy to achieve physical data independence.

With Physical independence, you can easily change the physical storage
structures or devices with an effect on the conceptual schema. Any change done
would be absorbed by the mapping between the conceptual and internal levels.
Physical data independence is achieved by the presence of the internal level of
the database and then the transformation from the conceptual level of the
database to the internal level.

o Physical data independence can be defined as the capacity to change the


internal schema without having to change the conceptual schema.
o If we do any changes in the storage size of the database system server, then
the Conceptual structure of the database will not be affected.
o Physical data independence is used to separate conceptual levels from the
internal levels.
o Physical data independence occurs at the logical interface level.

Examples of changes under Physical Data Independence


Due to Physical independence, any of the below change will not affect the
conceptual layer.

 Using a new storage device like Hard Drive or Magnetic Tapes


 Modifying the file organization technique in the Database
 Switching to different data structures.
 Changing the access method.
 Modifying indexes.
 Changes to compression techniques or hashing algorithms.
 Change of Location of Database from say C drive to D Drive

Logical Data Independence


Logical Data Independence is the ability to change the conceptual scheme
without changing

1. External views
2. External API or programs

Any change made will be absorbed by the mapping between external and
conceptual levels.

When compared to Physical Data independence, it is challenging to achieve


logical data independence.

o Logical data independence refers characteristic of being able to change the


conceptual schema without having to change the external schema.
o Logical data independence is used to separate the external level from the
conceptual view.
o If we do any changes in the conceptual view of the data, then the user view
of the data would not be affected.
o Logical data independence occurs at the user interface level.

Examples of changes under Logical Data Independence


Due to Logical independence, any of the below change will not affect the
external layer.

1. Add/Modify/Delete a new attribute, entity or relationship is possible


without a rewrite of existing application programs
2. Merging two records into one
3. Breaking an existing record into two or more records

Difference between Physical and Logical Data Independence


Logica Data Independence Physical Data Independence
Logical Data Independence is mainly concerned with
Mainly concerned with the storage of the data
the structure or changing the data definition.

It is difficult as the retrieving of data is mainly


It is easy to retrieve.
dependent on the logical structure of data.

Compared to Logic Physical independence it is difficult Compared to Logical Independence it is easy


to achieve logical data independence. achieve physical data independence.

You need to make changes in the Application program A change in the physical level usually does no
if new fields are added or deleted from the database. change at the Application program level.

Modification at the logical levels is significant Modifications made at the internal levels may
whenever the logical structures of the database are not be needed to improve the performance of
changed. structure.

Concerned with conceptual schema Concerned with internal schema

Example: change in compression techniques,


Example: Add/Modify/Delete a new attribute
algorithms, storage devices, etc

Importance of Data Independence

 Helps you to improve the quality of the data


 Database system maintenance becomes affordable
 Enforcement of standards and improvement in database security
 You don’t need to alter data structure in application programs
 Permit developers to focus on the general structure of the Database rather
than worrying about the internal implementation
 It allows you to improve state which is undamaged or undivided
 Database incongruity is vastly reduced.
 Easily make modifications in the physical level is needed to improve the
performance of the system.
components of DBMS
The database management system can be divided into five major components,
they are:

1. Hardware
2. Software
3. Data
4. Procedures
5. Database Access Language
Let's have a simple diagram to see how they all fit together to form a database
management system.
DBMS Components: Hardware

When we say Hardware, we mean computer, hard disks, I/O channels for data,
and any other physical component involved before any data is successfully
stored into the memory.

When we run Oracle or MySQL on our personal computer, then our computer's
Hard Disk, our Keyboard using which we type in all the commands, our
computer's RAM, ROM all become a part of the DBMS hardware.

DBMS Components: Software

This is the main component, as this is the program which controls everything.
The DBMS software is more like a wrapper around the physical database,
which provides us with an easy-to-use interface to store, access and update data.

The DBMS software is capable of understanding the Database Access Language


and intrepret it into actual database commands to execute them on the DB.
DBMS Components: Data

Data is that resource, for which DBMS was designed. The motive behind the
creation of DBMS was to store and utilise data.

In a typical Database, the user saved Data is present and meta data is stored.

Metadata is data about the data. This is information stored by the DBMS to
better understand the data stored in it.

For example: When I store my Name in a database, the DBMS will store when
the name was stored in the database, what is the size of the name, is it stored as
related data to some other data, or is it independent, all this information is
metadata.

DBMS Components: Procedures

Procedures refer to general instructions to use a database management system.


This includes procedures to setup and install a DBMS, To login and logout of
DBMS software, to manage databases, to take backups, generating reports etc.

DBMS Components: Database Access Language

Database Access Language is a simple language designed to write commands to


access, insert, update and delete data stored in any database.

A user can write commands in the Database Access Language and submit it to
the DBMS for execution, which is then translated and executed by the DBMS.

User can create new databases, tables, insert data, fetch stored data, update data
and delete the data using the access language.

You might also like