You are on page 1of 42

INTRODUCTION TO DBMS

DATABASE MANAGEMENT SYSTEM

• Data: Raw, unprocessed facts


ex: 24, Rahul, Bangalore
• Information: Processed data
ex: The age of Rahul is 24
• Database: Collection of related data
ex: Online banking system, library management system
• Meta-data: The database definition
• Database Management System: Software that enables users to create and
maintain the database
DBMS FUNCTIONALITIES

• Define: Specifying the data type, structures and constraints for the data to be
stored.
• Construct: Process of storing data on some storage medium.
• Manipulate: Querying the database to retrieve specific data, updating
database and generating reports.
• Share: Allows multiple users and programs to access the database
concurrently.
DBMS FUNCTIONALITIES - Example

DBMS FUNCTIONALITIES- Example


Properties of Database

1. A database represents some aspects of the real world


2. A database is a logically coherent collection of data with some inherent
meaning
3. A database is designed, built and populated with data for a specific purpose
DATABASE MANAGEMENT SYSTEM
• Collection of interrelated data
• Set of programs to access the data
• DBMS contains information about a particular enterprise
• DBMS provides an environment that is both convenient and efficient to use.
• Database Applications:
• Banking: all transactions
• Airlines: reservations, schedules
• Universities: registration, grades
• Sales: customers, products, purchases
• Manufacturing: production, inventory, orders, supply chain
• Human resources: employee records, salaries, tax deductions
• Databases touches all aspects of our lives
 PURPOSE OF DBMS

In the early days, database applications were built on top of file systems.

File System manages data using files in hard disk. Users are allowed to create,
delete, and update the files according to their requirement.

Let us consider the example of file based University Management System.


Data of students is available to their respective Departments, Academics
Section, Result Section, Accounts Section, Hostel Office etc.

Some of the data is common for all sections like Roll No, Name, Address and
Phone number of students but some data is available to a particular section
only like Hostel allotment number which is a part of hostel office.
Drawbacks with File System:

1. Redundancy of data: Data is said to be redundant if same data is copied at many


places. If a student wants to change Phone number, he has to get it updated at
various sections. Similarly, old records must be deleted from all sections
representing that student.

2. Inconsistency of Data: Data is said to be inconsistent if multiple copies of same


data does not match with each other. If Phone number is different in Accounts
Section and Academics Section, it will be inconsistent. Inconsistency may be
because of typing errors or not updating all copies of same data.

3. Difficult Data Access: A user should know the exact location of file to access
data, so the process is very cumbersome and tedious. If user wants to search
student hostel allotment number of a student from 10000 unsorted students’
records, how difficult it can be.
4. Unauthorized Access: File System may lead to unauthorized access to data.
If a student gets access to file having his marks, he can change it in
unauthorized way.

5. No Concurrent Access: The access of same data by multiple users at same


time is known as concurrency. File system does not allow concurrency as data
can be accessed by only one user at a time.

6. No Backup and Recovery: File system does not incorporate any backup and
recovery of data if a file is lost or corrupted.
What is Schema?

Schema – the logical structure of the database


e.g., the database consists of information about a set of
customers and accounts and the relationship between
them)
• Analogous to type information of a variable in a program

• Physical schema: database design at the physical level


• Logical schema: database design at the logical level.

• Instance – the actual content of the database at a particular


point in time
• Analogous to the value of a variable
• Applications depend on the logical schema
• In general, the interfaces between the various levels and
components should be well defined so that changes in
Schema- Example
View of data in DBMS narrate how the data is visualized at each level of data
abstraction? 

Data abstraction allow developers to keep complex data structures away


from the users. The developers achieve this by hiding the complex data
structures through levels of abstraction.
LEVELS OF ABSTRACTION
• Physical level describes how a record (e.g., customer) is stored.

• Logical level: describes data stored in database, and the relationships among
the data.
type customer = record
name : string;
street : string;
city : integer;
end;

• View level: application programs hide details of data types. Views can also
hide information (e.g., salary) for security purposes.
Example: Let’s say we are storing customer information in a
customer table. At physical level these records can be described as
blocks of storage (bytes, gigabytes, terabytes etc.) in memory.
These details are often hidden from the programmers.

At the logical level these records can be described as fields and


attributes along with their data types, their relationship among
each other can be logically implemented. The programmers
generally work at this level because they are aware of such things
about database systems.

At view level, user just interact with system with the help of GUI
and enter the details at the screen, they are not aware of how the
data is stored and what data is stored; such details are hidden
from them.
THREE SCHEMA ARCHITECTURE

• The three schema architecture is also called ANSI/SPARC


architecture or three-level architecture.

• This framework is used to describe the structure of a specific


database system.

• The three schema architecture is also used to separate the user


applications and physical database.

• The three schema architecture contains three-levels.


• INTERNAL LEVEL
• CONCEPTUAL LEVEL
• EXTERNAL LEVEL
Consider an Example of a University Database. At the different levels this is how the implementation will look like:

Type of Schema Implementation

External Schema View 1: Course


info(cid:int,cname:string)
View 2: studeninfo(id:int. name:string)

Conceptual Schema Students(id: int, name: string, login:


string, age: integer) Courses(id: int,
cname.string, credits:integer)
Enrolled(id: int, grade:string)

Physical Schema •Relations stored as unordered files.


The three-schema architecture defines the view of data at three
levels:
✔ Physical level (internal level)
✔ Logical level (conceptual level)
✔ View level (external level)

1. Physical level (internal level)

The physical or the internal level schema describes how the data is


stored in the hardware.

It also describes how the data can be accessed.

The physical level shows the data abstraction at the lowest level
and it has complex data structures. Only the database
administrator operates at this level.
2. Logical Level/ Conceptual Level:

• It is a level above the physical level.


• Here, the data is stored in the form of the entity
set, entities, their data types,
the relationship among the entity sets, user
operations performed to retrieve or modify the data
and certain constraints on the data.
• Well adding constraints to the view of data adds the
security. As users are restricted to access some
particular parts of the database.
• It is the developer and database administrator who
operates at the logical or the conceptual level.
3. View Level/ User level/ External level 

• It is the highest level of data abstraction and exhibits only a


part of the whole database.

• It exhibits the data in which the user is interested. The view


level can describe many views of the same data.

• Here, the user retrieves the information using different


application from the database.
• Mapping is used to transform the request and response
between various database levels of architecture.
• Mapping is not good for small DBMS because it takes more
time.
• In External / Conceptual mapping, it is necessary to transform
the request from external level to conceptual schema.
• In Conceptual / Internal mapping, DBMS transform the request
from the conceptual to internal level.
Data Independence
Data independence defines the extent to which the data schema can
be changed at one level without modifying the data schema at the
next level. Data independence can be classified as shown below:

1. Logical Data Independence:


Logical data independence describes the degree up to which the
logical or conceptual schema can be changed without modifying the
external schema. Now, a question arises what is the need to change
the data schema at a logical or conceptual level?
Well, the changes to data schema at the logical level are made either
to enlarge or reduce the database by adding or deleting more
entities, entity sets, or changing the constraints on data.
2. Physical Data Independence:
Physical data independence defines the extent up to which
the data schema can be changed at the physical or internal
level without modifying the data schema at logical and view
level.
Well, the physical schema is changed if we add additional
storage to the system or we reorganize some files to enhance
the retrieval speed of the records.
Data Model
• Data Model is the modeling of the data description, data semantics, and consistency
constraints of the data.
• It provides the conceptual tools for describing the design of a database at each level of
data abstraction.
• Therefore, there are following data models used for understanding the structure of the
database:
• Relational Data Model: This type of model designs the data in the form of rows and
columns within a table. Thus, a relational model uses tables for representing data and
in-between relationships. Tables are also called relations. This model was initially
described by Edgar F. Codd, in 1969. The relational data model is the widely used
model which is primarily used by commercial data processing applications.
 
• Entity-Relationship Data Model: An ER model is the logical representation of data
as objects and relationships among them.
• These objects are known as entities, and relationship is an association among
these entities. This model was designed by Peter Chen and published in 1976
papers.
• It was widely used in database designing. A set of attributes describe the entities.
For example, student_name, student_id describes the 'student' entity. A set of the
same type of entities is known as an 'Entity set', and the set of the same type of
relationships is known as 'relationship set‘.
• Object-based Data Model: An extension of the ER model with notions of functions,
encapsulation, and object identity, as well. This model supports a rich type system that
includes structured and collection types. Thus, in 1980s, various database systems
following the object-oriented approach were developed. Here, the objects are nothing
but the data carrying its properties.
• Semi structured Data Model: 
• This type of data model is different from the other three data models.The
semistructured data model allows the data specifications at places where the
individual data items of the same type may have different attributes sets.
• The Extensible Markup Language, also known as XML, is widely used for
representing the semistructured data. Although XML was initially designed for
including the markup information to the text document, it gains importance
because of its application in the exchange of data.
Database Language
• A DBMS has appropriate languages and interfaces to express database queries and
updates.

• Database languages can be used to read, store and update the data in the
database.
Data Definition Language

• DDL stands for Data Definition Language. It is used to define database structure or


pattern.
• It is used to create schema, tables, indexes, constraints, etc. in the database.
• Using the DDL statements, you can create the skeleton of the database.
• 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:

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


• Alter: It is used to alter the structure of the database.
• Drop: It is used to delete objects from the database.
• Truncate: It is used to remove all records from a table.
• Rename: It is used to rename an object.
• 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.
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:

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


• Insert: It is used to insert data into a table.
• Update: It is used to update existing data within a table.
• Delete: It is used to delete all records from a table.
• Merge: It performs UPSERT operation, i.e., insert or update operations.
Data Control Language

• DCL stands for Data Control Language. It is used to retrieve the stored or saved data.


• 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:

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


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

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


• Rollback: It is used to restore the database to original since the last Commit.
DATABASE INTERFACES:

• Menu-Based Interfaces for Web Clients or Browsing : These interfaces present the
user with lists of options, called menus, that lead the user through the formulation of
a request. Menus do away with the need to memorize the specific commands and
syntax of a query language; rather, the query is composed step by step by picking
options from a menu that is displayed by the system. Pull-down menus are a very
popular technique in Web-based user interfaces. They are also often used in browsing
interfaces, which allow a user to look through the contents of a database in an
exploratory and unstructured manner.

• Forms-Based Interfaces : A forms-based interface displays a form to each user. Users
can fill out all of the form entries to insert new data, or they fill out only certain
entries, in which case the DBMS will retrieve matching data for the remaining entries.
Forms are usually designed and programmed for naive users as interfaces to canned
transactions. Many DBMSs have forms specification languages, which are special
languages that help programmers specify such forms. Some systems have utilities that
define a form by letting the end user interactively construct a sample form on the
screen.
Graphical User Interfaces : A graphical interface (CUI) typically displays a schema to the
user in diagrammatic form. The user can then specify a query by manipulating the
diagram. In many cases, CUIs utilize both menus and forms. Most CUIs use a pointing
device, such as a mouse, to pick certain parts of the displayed schema diagram.

Natural Language Interfaces : These interfaces accept requests written in English or


some other language and attempt to "understand" them. A natural language interface
usually has its own "schema," which is similar to the database conceptual schema, as
well as a dictionary of important words. The natural language interface refers to the
words in its schema, as well as to the set of standard words in its dictionary, to interpret
the request. If the interpretation is successful, the interface generates a high-level query
corresponding to the natural language request and submits it to the DBMS for
processing; otherwise, a dialogue is started with the user to clarify the request.
• SPEECH INPUT AND OUTPUT:
• Speech as an input query and speech as an answer to a request .
• The speech input is detected using a library of predefined words.

• Interfaces for Parametric Users : Parametric users, such as bank tellers, often have a
small set of operations that they must perform repeatedly. Systems analysts and
programmers design and implement a special interface for each known class of naive
users. Usually, a small set of abbreviated commands is included, with the goal of
minimizing the number of keystrokes required for each request.

• Interfaces for the DBA : Most database systems contain privileged commands that
can be used only by the DBA's staff. These include commands for creating accounts,
setting system parameters, granting account authorization, changing a schema, and
reorganizing the storage structures of a database.
DBMS COMPONENT MODULES
• The diagram here is divided into two halve. The top half of the diagram refers to the
various users of the database environment and their interfaces.
• The lower half demonstrates the internals of the DBMS responsible for storage of data
and processing of transaction.

• The database and the DBMS catalogue are usually stored on disk. Access to the disk is
principally controlled by operating system (OS).
• This includes disk input / Output. A higher point stored data manager module of DBMS
controls access to DBMS information that is stored on the disk.

• If we consider the top half of the diagram it shows interface to casual users, DBA staff,
application programmers and parametric users.
• The DDL compiler specified in the DDL, processes schema definitions as well as stores
the description of the schema in the DBMS Catalogue. The catalogue includes
information such as names and sizes of the sizes of the files and data types of data of
data items.
• Storage particulars of every file mapping information among schemas as well as
constraints.
• Casual users as well as persons with occasional need of information from database
interact using some of interface which is interactive query interface.
• The queries are parsed analyze for correctness of the operations for the model. The
names of the data elements as well as therefore on by a query compiler that
compiles them into internal form.
• The interior query is subjected to query optimization. The query optimizer is worried
with rearrangement and possible recording of operations and eliminations of
redundancies.
• Application programmer inscribes programs in host languages. The precompiled take

You might also like