You are on page 1of 30

What is Data?

Data is a collection of a distinct small unit of information. It can be used in a


variety of forms like text, numbers, media, bytes, etc. it can be stored in pieces
of paper or electronic memory, etc.

Word 'Data' is originated from the word 'datum' that means 'single piece of
information.' It is plural of the word datum.

In computing, Data is information that can be translated into a form for


efficient movement and processing. Data is interchangeable.

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 System

o Database management system is a software which is used to manage


the database. For example: MySQL, Oracle, etc are a very popular
commercial database which is used in different applications.
o 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.
o 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.

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 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.

Advantages of DBMS

o Controls database redundancy


o Data sharing
o Easily Maintenance:
o Reduce time
o Backup
o multiple user interface

Disadvantages of DBMS

o Cost of Hardware and Software


o Size
o Complexity.
o Higher impact of failure
Data dictionary:

The data dictionary in general contains information about the following-

 Name of all database tables and their schemas.


 Details about all the tables in the database,such as their owners,their
security constraints,when they were created etc.
 Physical information about the tables such as where they are stored and
how.
 Table constraints such as primary key,foreign key information etc.

There are two types of data dictionary:

o Active data dictionary


o Passive data dictionary

ACTIVE DATA DICTIONARY:


 If the structure of the database or its specifications change at any point
of time,it should be reflected in the data dictionary.This is the
responsibility of the database management system in which the data
dictionary resides.
 So,the data dictionary is automatically updated by the database
management system when any changes are made in the database.this is
known as an active data dictionary as it is self updating.
 It is also called integrated data dictionary.
 Consistent with the current structure and definition of the database.
 Most of the RDBMS contains Active data dictionary that can be derived
from system catalog.

Passsive data dictionary:


 The database manager maintains the data dictionary as a separate entity
that has to be updated manually,it is referred to as a passive data
dictionary.
 A passive data dictionary is maintained separately to the database
whose contents are stored in the dictionary.That means that if the
database in modified the database dictionary is not automatically
updated as in the case of Active data dictionary.
 So,the passive data dictionary has to be manually updated to match the
database.this needs careful handling or else the database and the data
dictionary are out of sync.

Benefits of data dictionary:

 Documentation
 Consistency in data
 Easier data analysis
 Reduced data redundancy
 Simpler programming

Data Administrator (DA) :

Data administrator is a person who is responsible for processing data into a


convenient data model. The person is in charge of figuring out which data is
relevant to be stored in the database. Data Administrator is less of a technical
role and more of a business role with some technical knowledge. This role is
also known as Data Analyst. So, it is mostly a high level function which is
responsible for the overall management of data resources in an organization.

Responsibilities :
 Filters out relevant data
 Monitor the data flow throughout the organization
 Designs concept-based data model
 Analyze and break down the data to be understood by the non-tech person

02. Database Administrator (DBA) :


Database administrator is a person who creates updates and maintains the
database. It is more of a wide role as a data administrator might be someone
who is hired to create, maintain, and backup the database, optimize the
database for high performance, or someone who helps in integrating
databases into applications. The major skills required to be an excellent
database administrator are troubleshooting, logical thought process, and a
strong will to learn as it involves a vast area. This role is also known as
Database Coordinator or Database Programmer.
Responsibilities :
 Create and design a database
 Analyze and monitor database requirements
 Ensures data security

Difference between Data Administrator (DA) and Database Administrator


(DBA) :
S.NO. DATA ADMINISTRATOR DATABASE ADMINISTRATOR

Database admin is also known as


Data admin is also known as
01. database coordinator or database
data analyst.
programmer.

Data admin converts data into a Database admin inputs data into
02.
convenient data model. the database.

Data admin analyzes the Database admin optimizes and


03.
database for relevant data. maintains the database.

Data admin monitors data flow Database admin ensures database


04.
across the organization. security.

05. Data admin handles issues Database admin handles issues


concerning the data. with the database.

Data admin requires excellent Database admin mostly require


06. data analyzing, expression of logical thought process,
ideas, and strategic thinking. troubleshooting and will to learn.

Data admin is less of a technical


Database admin is a wide role as it
07. role and more of a business
has multiple responsibilities
role.

Main tasks include data Main tasks include database


planning, definition, design, construction, security,
08.
architecture and management backup and recovery, performance
etc. tuning etc.

It set policies and standards ,


It enforces policies and procedures,
09. coordinates and manages
choose and maintains technology.
database design.

10. Generally it owns the data. Where as it owns the database.

It performs the high level


11. It performs the technical function.
function.

Data administration is DBMS Database administration is DBMS


12.
independent. specific.

File System :
The file system is basically a way of arranging the files in a storage medium
like a hard disk. The file system organizes the files and helps in the retrieval of
files when they are required. File systems consist of different files which are
grouped into directories. The directories further contain other folders and
files. The file system performs basic operations like management, file naming,
giving access rules, etc.

Example: NTFS(New Technology File System), EXT(Extended File System).


File System

DBMS(Database Management System) :


Database Management System is basically software that manages the
collection of related data. It is used for storing data and retrieving the data
effectively when it is needed. It also provides proper security measures for
protecting the data from unauthorized access. In Database Management
System the data can be fetched by SQL queries and relational algebra. It also
provides mechanisms for data recovery and data backup.

Example:

Oracle, MySQL, MS SQL server.


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

Schema:

 The overall design of the database is called the database schema.


 The logical structure of database.
 Example: the database consists of information about a set of
customers and accounts and the relationship between them
 Database system has several schemas-
o Physical schema at the lowest level(physical level)
o Logical schema at the intermediate level(logical level)

Sub-schema:

 A database may also have several schemas at the view level,sometimes


called subschema.
 Subschema at the highest level.
Instances:
 The collection of information stored in the database as a particular
moment is called an instance of the database.
 Database change over time as information is inserted and deleted.

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.

Objectives of 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:

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.

Data Independence

o Data independence can be explained using the three-schema


architecture.
o Data independence refers characteristic of being able to modify the
schema at one level of the database system without altering the schema
at the next higher level.

There are two types of data independence:

1. 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.

2. Physical Data Independence

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.

What is Mapping in DBMS?

The process of transforming a request and result between three


levels is called mapping. The user’s request is specified at an
external level which must be transferred at a conceptual level.
Finally, this request is transformed at an interna l level for the final
processing of data in the stored database.

Hence mapping in DBMS is used to interconnect the three levels of


databases.
Block Diagram of Mapping

Types of Mapping in DBMS

There are two types of mapping in DBMS as shown below:


External/Conceptual Mapping

The process of transforming requests and results between external


and conceptual levels is called external/conceptual mapping. shown
in the above mapping block, the diagram, external views are
connected to conceptual views with the help of external/conceptual
mapping.

Conceptual/Internal Mapping

The conceptual schema is connected to the internal schema with the


help of conceptual/internal mapping. This enables DBMS to finalize
the actual record in physical storage. The process of transforming
requests and results between the conceptual and internal levels is
called conceptual/external mapping.

STRUCTURE OF DBMS

DBMS (Database Management System) acts as an interface between the user


and the database. The user requests the DBMS to perform various operations
(insert, delete, update and retrieval) on the database. The components of
DBMS perform these requested operations on the database and provide
necessary data to the users. The various components of DBMS are shown
below: -

Fig.Structure Of DBMS
1. DDL Compiler - Data Description Language compiler
processes schema definitions specified in the DDL. It
includes metadata information such as the name of the files,
data items, storage details of each file, mapping information
and constraints etc.

2. DML Compiler and Query optimizer - The DML commands such as


insert, update, delete, retrieve from the application program are sent to the
DML compiler for compilation into object code for database access. The object
code is then optimized in the best way to execute a query by the query
optimizer and then send to the data manager.

3. Data Manager - The Data Manager is the central software component


of the DBMS also knows as Database Control System.

The Main Functions Of Data Manager Are: –

• Convert operations in user's Queries coming from the application programs


or combination of DML Compiler and Query optimizer which is known as Query
Processor from user's logical view to physical file system.

• Controls DBMS information access that is stored on disk.

• It also controls handling buffers in main memory.

• It also enforces constraints to maintain consistency and integrity of the data.

• It also synchronizes the simultaneous operations performed by the


concurrent users.

• It also controls the backup and recovery operations.

4. Data Dictionary - Data Dictionary is a repository of description of data


in the database. It contains information about

• Data - names of the tables, names of attributes of each table, length of


attributes, and number of rows in each table.
• Relationships between database transactions and data items referenced by
them which is useful in determining which transactions are affected when
certain data definitions are changed.

• Constraints on data i.e. range of values permitted.

• Detailed information on physical database design such as storage structure,


access paths, files and record sizes.

• Access Authorization - is the Description of database users their


responsibilities and their access rights.

• Usage statistics such as frequency of query and transactions.

Data dictionary is used to actually control the data integrity, database


operation and accuracy. It may be used as a important part of the DBMS.

Importance of Data Dictionary -

Data Dictionary is necessary in the databases due to following reasons:

• It improves the control of DBA over the information system and user's
understanding of use of the system.

• It helps in documentating the database design process by storing


documentation of the result of every design phase and design decisions.

• It helps in searching the views on the database definitions of those views.

• It provides great assistance in producing a report of which data elements (i.e.


data values) are used in all the programs.

• It promotes data independence i.e. by addition or modifications of structures


in the database application program are not effected.

5. Data Files - It contains the data portion of the database.

6. Compiled DML - The DML complier converts the high level Queries
into low level file access commands known as compiled DML.

7. End Users - They are already discussed in previous section.


Components of DBMS Structure

The structure of DBMS is divided into three components namely "Query


Processor", "Storage Manager", and "Disk Storage". Each of these components
plays a very crucial role in Database Management. Hence we will see all three
of them with a due concentration on detail. Before moving into details let us
have a quick overview of the structure of DBMS. Here we go,

 Query Processor
o DML Compiler
o DDL Interpreter
o Embedded DML Pre-compiler
o Query Evaluation Engine
 Storage Manager
o Authorization and Integrity Manager
o Transaction Manager
o File Manager
o Buffer Manager
 Disk Storage
o Data Files
o Data Dictionary
o Indices
o Statistical Data

 Functions of Database Management System (DBMS)


DBMS performs several important functions that guarantee the integrity and
consistency of the data in the database. The most important functions of
Database Management System are

Data Dictionary Management,


Data Storage Management,
Data Transformation and Presentation,
Security Management,
Multi user Access Control,
Backup and Recovery Management,
Data Integrity Management,
Database Access Languages and Application Programming Interfaces and
Database Communication interfaces.

Data Models

What are Data Models in DBMS?

Data models in DBMS help to understand the design at the conceptual,


physical, and logical levels as it provides a clear picture of the data making it
easier for developers to create a physical database.

Data models are used to describe how the data is stored, accessed,
and updated in a DBMS. A set of symbols and text is used to represent them so
that all the members of an organization can understand how the data is
organized. It provides a set of conceptual tools that are vastly used to
represent the description of data.

There are many types of data models that are Data Models in DBMS
Data models in DBMS are used to define the structure and organization of data
in a database.They provide a way to represent the relationships between
different data entities and constraints on the data. On this page, we will learnt
about types of data models in DBMS.
Types of Data Models in DBMS

 Hierarchical database model


 Relational model
 Network model
 Entity-relationship model
 Object-oriented database model
 Document model
 Entity-attribute-value model
 Star schema

Let us learn more about in detail –

Hierarchical database model

The Hierarchical model is inspired from tree based data structure format.
Where in there is a single root node and other data is linked to the same and
expands like a tree.
1. A child node data may only have a single parent node
2. For any parent node one to many relationship must be maintained.

Network model

Network model was made to overcome the drawbacks fo hierarchical model.


This works more like a graph rather than a tree.

o As the name suggests there is network based looped relationship


between various data linked to one another.
o A child node may have more than one parent. ( As for Node – N6)
o There can be many to many relationships between data.

This was very much used before there was relational data model in practise.
Since, there are various networks relationships. It was a very fast way to access
any data.

Entity-relationship model

This is modeled about break and related model, i.e. we break data into
different components based on characteristics, in terms of entity and
attributes.

Imagine an entity student, its various attributes maybe studentID, age,


dateOfBirth etc etc. It may have a relationship with courses offered to the
student, which further may have attributes like CourseID and credits.
o Entity – These are representation of a real world entities in code.
o Attributes – These are the characteristic properties of entities
o Relationship – Logical relationship between various entities
involved in the Database creation.
o One to one
 One to many
 Many to one

 Many to many

Relational model

This is the most used model and even with DBMS that we will studying in
future posts it will be based upon the same. Relational model is a tabular 2
dimensional relationship between various related tables having atleast one
common field. This works around

o Rows
o Entities
o Tuples
o Columns
o Table
Object-oriented database model

The increasing complexity of the code in the modern age, where we try to
create real time scenerios. Specially in Artificial Intelligence, Machine learning
or Image processing.

We need a database that can also represent the real work scenerios very
clearly and hence it is solved by having an object oriented database model.

o An object is an abstraction of a real-world entity. More or less an


object is a real world instance of an entity in Entity Relationship
Model
o Attributes describe the properties of an object, i.e customerID or
orderID maybe called as properties of the object or attributes as in
entity relationship model
o As we use classes and inheritance in OOPs concept. The similar can
be used here. Classes are a superior set of objects with similar
characteristics right?
o Inheritance is highly used in such, thus also using network or
hierarchical model as default inspirations
Relational database systems are expected to be equipped with a query
language that can assist its users to query the database instances. There are
two kinds of query languages − relational algebra and relational calculus.

Relational Algebra
Relational algebra is a procedural query language, which takes instances of
relations as input and yields instances of relations as output. It uses operators
to perform queries. An operator can be either unary or binary. They accept
relations as their input and yield relations as their output. Relational algebra is
performed recursively on a relation and intermediate results are also
considered relations.
The fundamental operations of relational algebra are as follows −
 Select
 Project
 Union
 Set different
 Cartesian product
 Rename
We will discuss all these operations in the following sections.

Select Operation (σ)

It selects tuples that satisfy the given predicate from a relation.


Notation − σp(r)
Where σ stands for selection predicate and r stands for relation. p is
prepositional logic formula which may use connectors like and, or, and not.
These terms may use relational operators like − =, ≠, ≥, < , >, ≤.
For example −
σsubject = "database"(Books)
Output − Selects tuples from books where subject is 'database'.
σsubject = "database" and price = "450"(Books)
Output − Selects tuples from books where subject is 'database' and 'price' is
450.
σsubject = "database" and price = "450" or year > "2010"(Books)
Output − Selects tuples from books where subject is 'database' and 'price' is
450 or those books published after 2010.

Project Operation (∏)

It projects column(s) that satisfy a given predicate.


Notation − ∏A1, A2, An (r)
Where A1, A2 , An are attribute names of relation r.
Duplicate rows are automatically eliminated, as relation is a set.
For example −
∏subject, author (Books)
Selects and projects columns named as subject and author from the relation
Books.

Union Operation (∪)

It performs binary union between two given relations and is defined as −


r ∪ s = { t | t ∈ r or t ∈ s}
Notation − r U s
Where r and s are either database relations or relation result set (temporary
relation).
For a union operation to be valid, the following conditions must hold −
 r, and s must have the same number of attributes.
 Attribute domains must be compatible.
 Duplicate tuples are automatically eliminated.
∏ author (Books) ∪ ∏ author (Articles)
Output − Projects the names of the authors who have either written a book or
an article or both.

Set Difference (−)

The result of set difference operation is tuples, which are present in one
relation but are not in the second relation.
Notation − r − s
Finds all the tuples that are present in r but not in s.
∏ author (Books) − ∏ author (Articles)
Output − Provides the name of authors who have written books but not
articles.

Cartesian Product (Χ)

Combines information of two different relations into one.


Notation − r Χ s
Where r and s are relations and their output will be defined as −
r Χ s = { q t | q ∈ r and t ∈ s}
σauthor = 'tutorialspoint'(Books Χ Articles)
Output − Yields a relation, which shows all the books and articles written by
tutorialspoint.

Rename Operation (ρ)

The results of relational algebra are also relations but without any name. The
rename operation allows us to rename the output relation. 'rename' operation
is denoted with small Greek letter rho ρ.
Notation − ρ x (E)
Where the result of expression E is saved with name of x.
Additional operations are −
 Set intersection
 Assignment
 Natural join
Relational Calculus
In contrast to Relational Algebra, Relational Calculus is a non-procedural query
language, that is, it tells what to do but never explains how to do it.
Relational calculus exists in two forms −
Tuple Relational Calculus (TRC)
Filtering variable ranges over tuples
Notation − {T | Condition}
Returns all tuples T that satisfies a condition.
For example −
{ T.name | Author(T) AND T.article = 'database' }
Output − Returns tuples with 'name' from Author who has written article on
'database'.
TRC can be quantified. We can use Existential (∃) and Universal Quantifiers (∀).
For example −
{ R| ∃T ∈ Authors(T.article='database' AND R.name=T.name)}
Output − The above query will yield the same result as the previous one.
Domain Relational Calculus (DRC)
In DRC, the filtering variable uses the domain of attributes instead of entire
tuple values (as done in TRC, mentioned above).
Notation −
{ a1, a2, a3, ..., an | P (a1, a2, a3, ... ,an)}
Where a1, a2 are attributes and P stands for formulae built by inner attributes.
For example −
{< article, page, subject > | ∈ TutorialsPoint ∧ subject = 'database'}
Output − Yields Article, Page, and Subject from the relation TutorialsPoint,
where subject is database.
Just like TRC, DRC can also be written using existential and universal
quantifiers. DRC also involves relational operators.
The expression power of Tuple Relation Calculus and Domain Relation Calculus
is equivalent to Relational Algebra.

You might also like