Database and DBMS Introduction
Database and DBMS Introduction
Database and DBMS Introduction
What is Data?
In simple words, data can be facts related to any object in
consideration. For example, your name, age, height, weight, etc. are
some data related to you. A picture, image, file, pdf, etc. can also be
considered data.
What is Information?
When data are processed, organized, structured, and interpreted in a
given context, so as to make them useful and meaningful, they are
called information.
Example: Name - Ankit, City - Delhi, Class – 12, Marks – 80.
What is Database?
A database is a shared collection of logically related data and its
description, designed to meet the information needs of an
organization.
Why a Database?
Size
Accuracy
“Do you care if someone entered incorrect data?”. If yes, nothing could
actually prevent me from typing incorrect data into a spreadsheet.
Security
If the data is sensitive, and you need to restrict access to the data; It
doesn’t need to be shared with everyone. In addition, “Do you need to
know who made every change at every point?”.
Redundancy
If the redundant data (having multiple copies of the same data) will
lead to conflict, you would need to have only non-repeated unique
data.
Importance
How about having more than one person overwriting the same data at
the same time. How about 10 at the same time or 100 people at the
same time?. You’ll end up with everybody overwriting everybody else’s
changes.
DATABASE COMPONENTS
There are five main components of a database:
Hardware:
The hardware consists of physical, electronic devices like computers,
I/O devices, storage devices, etc. This offers the interface between
computers and real-world systems.
Software:
This is a set of programs used to manage and control the overall
database. This includes the database software itself, the Operating
System, the network software used to share the data among users, and
the application programs for accessing data in the database.
Data:
Data is a raw and unorganized fact that is required to be processed to
make it meaningful. Data can be simple at the same time unorganized
unless it is organized. Generally, data comprises facts, observations,
perceptions, numbers, characters, symbols, images, etc.
Procedure:
Procedure are a set of instructions and rules that help you to use the
DBMS. It is designing and running the database using documented
methods, which allows you to guide the users who operate and manage
it.
The DBMS is the software system that enables users to define, create,
maintain and control access to the database.
The database has your actual data and the rules about that data, while
the DBMS is the program that surrounds and manages your actual
data, and it enforces the rules you specified on your data. The rules for
example could be the type of the data, like integer or string, or the
relationship between them.
Roles of a DBMS
1. Provides a security system which prevents unauthorized access to
the database.
2. Provides an Integrity system which maintains consistency of the
stored data.
3. Provides a concurrency control system which allows shared
access of the database.
4. Provides a recovery control system which restores the database to
a previous consistent state following a hardware or software
failure.
5. Provides a user accessible catalog which contains description of
the data in the database.
Advantages of DBMS
• Sharing of data - DBMS offers a variety of techniques to enable sharing of
data.
• Improved Data integrity – Database integrity refrs to the validity and
consistency of stored data.
• Improved security – Database security is the protection of the database from
unauthorized users. This security may take the form of user names and
passwords to identify users authorized to access the database.
• Enforcement of standards – Integration allows the Database Administrator
to defineand enforce the necessary standards. May include data formats to
facilitate exchange of data between systems, naming conventions,
documentation standards etc.
• Economy of scale – Combining all the organization operational data into one
database and creating a set of applications that work on this source of data
can result in cost savings.
• Improved data accessibility and responsiveness – Many DBMS provide query
languages or report writers that allows users to ask ad hoc questions and to
obtain the required information almost immediately at their terminal.
• Increased Productivity – DBMS provides many of the standard functions that
allows the programmer to concentrate on the specific functionality required
by the users.
• Improved maintenance through data independence.
• Increased concurrency.
• Backup and recovery services.
Disadvantage of DBMS
DBMS may offer plenty of advantages but, it has certain flaws-
• Cost of Hardware and Software of a DBMS is quite high which increases the
budget of your organization.
• Most database management systems are often complex systems, so the
training for users to use the DBMS is required.
• In some organizations, all data is integrated into a single database which can
be damaged because of electric failure or database is corrupted on the
storage media.
• Use of the same program at a time by many users sometimes lead to the loss
of some data.
• DBMS can’t perform sophisticated calculations.
• Non-Relational
• Relational
Non-Relational Database Management System (Non-RDBMS)
In RDBMS, two or more tables may be related to each other. Hence the term
"Relational". For example,
Example: Relationship in RDBMS
There are four common types of database model that are useful for
different types of data or information. Depending upon your specific
needs, one of these models can be used.
1. Hierarchical databases.
2. Network databases.
3. Relational databases.
4. Object-oriented databases.
1. Hierarchical databases
This type of Database model is rarely used nowadays. Its structure is like
a tree with nodes representing records and branches representing fields.
The windows registry used in Windows XP is an example of a
hierarchical database. Configuration settings are stored as tree
structures with nodes.
Advantages
Disadvantages
2. Network databases
Disadvantage:
• All the records are maintained using pointers and hence the whole
database structure becomes very complex.
• The insertion, deletion and updating operations of any record require
the large number of pointers adjustments.
• The structural changes to the database is very difficult.
3. Relational Database
In relational model, three key terms are heavily used such as relations,
attributes, and domains. A relation nothing but is a table with rows and
columns. The named columns of the relation are called as attributes, and
finally the domain is nothing but the set of values the attributes can take.
The following figure gives us the overview of rational database model.
Keys of a relation-
• Primary key- it is the key that uniquely identifies a table. It doesn’t have
nullvalues.
• Foreign key- it refers to the primary key of some other table.it permits
only those values which appear in the primary key of the table to which
it refers.
Advantage
Disadvantages
4. Object-oriented databases
The following figure shows the difference between relation and object-
oriented database model.
The following figure shows an example of object-oriented model.
Advantages
• There isno universally defined data model for an OODBMS, and most
models lack a theoretical foundation.
• In comparison to RDBMSs the use of OODBMS is still relatively
limited.
• There is a Lack of support for security in OODBMSs that do not
provide adequate security mechanisms.
• The system more complex than that of traditional DBMSs.
5. File system is used for storing the unstructured 5. Database management system is used for storing
data. the structured data.
6. In the file system, data redundancy is high. 6. In DBMS, Data redundancy is low.
10. If one application fails, it does not affect other 10. If the database fails, it affects all application which
application in a system. depends on it.
11. In the file system, data cannot be shared 11. In DBMS, data can be shared as it is stored at one
because it is distributed in different files. place in a database.
13. Example: NTFS (New technology file system), 13. Example: Oracle, MySQL, MS SQL Server, DB2,
EXT (Extended file system), etc. Microsoft Access, etc.
DBMS ARCHITECTURE
• 1 tier Architecture
• 2 tier Architecture
• 3 tier Architecture
1 Tier Architecture
In this architecture, the user directly interacts with the database itself,
which means that it is accessible to the user to create, alter or delete
the data.
The user directly sits on the database, and there is no layer between the
user and the database. Therefore, there is no data abstraction; the
whole data is available.
There is no interactive user interface.
This architecture is only preferred when the user aims to prepare a
local application as there is no real security is in this architecture.
This method provides a quick response to the user.
2 Tier Architecture
This architecture is rather the simplest version of a server-client
application.
It provides an application layer that works as an isolating layer
between the client and the database server. But this application layer is
only available on the user side.
This application layer is only available at the client end. This
application layer provides a certain level of data abstraction.
The user interfaces and application program provide different views to
the different users run on the user-side. In contrast, the server-side
provides various functionalities such as translating and performing
queries.
The user can only communicate using the application layer at the
client-side, and the server end application interacts with the database.
3 Tier Architecture
This architecture is similar to 2 Tier architecture as it also provides an
intermediate layer between the client and the database server. The only
difference is that it adds one more application layer as an intermediate,
and now the application layer is available at both the client and the
server sides.
In this architecture, the user connects through the user application,
and that user application interacts with the application server that
communicates with the databases.
This provides ample layer to abstract the data.
Any modification in the data done by the user does not directly affect
the database itself. The changes are first performed on the application
layer. There is no real connection between the database and the user.
The query processing and other functionalities of the database
management system are performed at the server-side application.
It allows the DBA to manage the access of the various users. It also
enables concurrent transactions on the database.
Schema Architecture
It describes the architecture of the database at various levels.
There are three layers of schema that separates the physical, logical
and application part of the database. Physical Schema, Logical Schema
and the External Schema are mapped together.
There are two levels of mapping between various levels.
At the external-conceptual level and the conceptual-internal level, the
request and response are transformed to communicate between these
two layers.
They interact with each other to perform the operations on the
database. A schema represents all the database entities and the
relationship between those entities.
The overall description of the database is called the database
Schema.
Internal Level
It defines the physical structure of the database. It defines the format
in which the data will be stored or, say, the structure in which the data
will be stored. It is also known as the Physical Schema. It describes the
complex low-level data structures of the database. At this level of
schema, the database administrator determines the definition of the
database by using data definition language. The user does not have
access to this level, requiring special rights. Initially, only the data
administrator can alter any change into it.
Conceptual Level
At this level, we describe the design of the database. It describes what
data will be stored in the database. This is called the logical schema;
the end-user does not have access to this layer. The programmers and
database administrators are the only ones with access to this level. At
this level, we store the data in the data structures described at the
physical level. However, the details of the implementation of the
physical level are kept hidden at this level.
External Level
It describes the various views of the database. This level is also called
the view level. There can be different views for different users
depending on the needs of the end-users.
At this level, the end-user interacts with the database, and the details
of both physical and logical schemas are kept hidden from the user.
The hiding of details of one level from other and only showing the
necessary information is called abstraction.
DBMS LANGUAGES
User can access, update, delete, and store data or information in the
database using database languages. The following are the databases
languages in the database management system:
• Data Definition Language
• Data Manipulation Language
• Data Control Language
• Transaction Control Language
Data Definition Language (DDL)
Data Definition Language is used for defining the structure or schema
of the database. It is also used for creating tables, indexes, applying
constraints, etc. in the database.
The main purpose of DDL is to store the information of metadata like
the number of schemas and tables, their names, indexes, constraints,
columns in each table, etc. The result of Data Definition Language
statements will be a set of tables which are stored in a special file
called data directory or data dictionary.
This language is used by the conceptual schema to access and retrieve
the records from/to the database respectively, where these records
describe entities, relationship, and attributes.
There are following Data Definition Languages (DDL)
Commands: