0% found this document useful (0 votes)
14 views53 pages

Hsslive Xii Cs Chapter 8 Database Management System

This document discusses the fundamentals of Database Management Systems (DBMS), emphasizing their advantages over conventional file systems, such as reduced data redundancy, improved data consistency, and enhanced security. It outlines key concepts including data abstraction, data independence, and the roles of different users, such as Database Administrators and application programmers. Additionally, it covers relational data models, key terminologies, and operations in relational algebra, providing a comprehensive overview of database management principles.

Uploaded by

adharshgopi0
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views53 pages

Hsslive Xii Cs Chapter 8 Database Management System

This document discusses the fundamentals of Database Management Systems (DBMS), emphasizing their advantages over conventional file systems, such as reduced data redundancy, improved data consistency, and enhanced security. It outlines key concepts including data abstraction, data independence, and the roles of different users, such as Database Administrators and application programmers. Additionally, it covers relational data models, key terminologies, and operations in relational algebra, providing a comprehensive overview of database management principles.

Uploaded by

adharshgopi0
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 53

Chapter-8

DATABASE MANAGEMENT SYSTEM


SIRAJ.F.M
HSST COMPUTER SCIENCE
AKGS GHSS PERALASSERY
Conventional Filesystem

File system is a software that manages and organizes the files in a
storage medium within a computer.

Redundant data can be present in a file system.

Eg:

If a student takes new admission and joins NSS his/her details will
be stored both in Admission file and in NSS file.

It doesn’t provide backup and recovery of data if it is lost.

There is less data consistency in file system.

File systems provide less security

No standardisation on data

Note :Redundancy means storing of same data in multiple
locations.
Concept of Database


A database is an organized collection of inter related data.
A DBMS (Database Management System) is a set of
programs.

Used to create, access and maintain a database.

The primary goal of DBMS is to provide an environment
that is both convenient and efficient in storing and
retrieving database information.
DBMS (DATABASE MANAGEMENT SYSTEM)


A Database Management System is defined as the
software system that allows users to define, create,
maintain and control access to the database.

A DBMS makes it possible for end users to create,
read, update and delete data in database. It is a layer
between programs and data.
Need of database

Database is an organized collection of inter-related data
stored together with minimum redundancy, in a manner
that makes them accessible for multiple applications.

Database Management System (DBMS) is essentially a
set of programs which provides storage, retrieval and
management of database.

The primary goal of DBMS is to provide an
environment that is both convenient and efficient to use
in retrieving and storing database.
Advantages of DBMS

Database systems are designed to manage large volumes of information.

A DBMS consists of a collection of data and a set of programs to access
those data.

1) Controlling Data Redundancy :-Duplication of data is called data
redundancy. In a file management system, data may be repeated in many
files. This leads to data redundancy. A DBMS keeps data at one place
and all users and applications access the centrally maintained database.

2) Data consistency:-Data redundancy leads to inconsistency .ie, when
two entries about the same data does not match each other. An
inconsistent database provides incorrect data. Inconsistency can be
controlled by controlling data redundancy.

3) Efficient data access:-A DBMS provides an efficient access to
database.

4) Data integrity:-Data integrity refers to correctness of data stored in the
database. Data integrity is maintained through implementing rules and
procedures. It can also be done by using error checking and validation.

5) Data Security:-Data security refers to protecting data against accidental
lose or disclosure. Data security can be done by using passwords. It won’t
allow unauthorized destruction or modification.

6) Sharing of data:-The data stored in the database can be shared among
multiple programs and users.

7) Enforcement of standards:-The database administrator defines and
enforces standard. These standards may be laid by the organization or
individual who uses data. Applicable standard might include naming
conventions, display formats, update procedure, access rules etc.

8) Crash recovery:-A DBMS provides a mechanism for data backup and
recovery from hardware failure.
Components of DBMS

DBMS have several components, each Performing
very significant tasks in its environment.

They are

Hardware

Software

Data

Users

Procedures

Hardware: It is the actual computer system used for storage and retrieval of the database. This includes
computers (PCs, workstations, servers and supercomputers), storage devices (hard disks, magnetic tapes),
network devices (hubs, switches, routers) and other supporting devices for storing and retrieval of data.

Software :The main component of a DBMS is the software. It is the set of programs used to handle the
database .It control and manage the overall database.

Data: It is the most important component of DBMS . The database contains operational data and the meta-data
(data about data). The database contains all the data needed by the organization.


Field:-A field is the smallest unit of stored data. Each field consist of data of a
specific type. For example Roll

No,Name,Place etc.

Record:-A record is a collection of related fields.

Files:-A files is a collection of same type of records.
Procedure to install a new DBMS


Log onto the DBMS.

Use a particular dbms facility or application
program.

Start and stop the dbms.

Make backup copies of the database or handle
hardware or software failures

Reorganize the database across multiple disks,
improve performance, or archive data to secondary
storage.
Data abstraction and data independence


The process of hiding irrelevant details from user is
called data abstraction.

The data in a DBMS is described at three levels of
abstraction. They are

Physical Level

Conceptual Level

View Level.

1) Physical Level(Internal Level):-It is the lowest level of
abstraction. It describes how data is actually stored in the storage
medium such as disks, tapes etc. and which file organization is used .
It describes complex low level data structure in detail.

2) Logical Level(Conceptual Level):-Logical level describes what
data are stored in the database and the relationship between data. It is
also called global view and represents the entire database. It is used by
database administrator.

3) View Level(External Level):-This is the highest level of database
abstraction and is near to the users. It is concerned with the way in
which individual users view the data. It describes only a part of entire
database. This simplifies the interaction with the system.
Data Independence

The ability to modify the schema definition in one level without
affecting the schema definition at the next higher level is called data
independence. There are two levels of data independence

1. Physical data independence

It refers to the ability to modify the schema at the physical level
without affecting the schema followed at the logical level.
ie ,application programs remain the same evenif the schema at the
physical level get changed

2. Logical data independence

It refers to the ability to modify the schema at the logical level
without affecting the schema followed at the view level

Different users in database

Based on the mode of interaction with DBMS the users of a database


are classified into four

Database Administrator (DBA)

Application Programmers

Sophisticated Users

Naive Users
Database Administrator:


The person who is responsible for the control of the
centralized and shared database is the Database
Administrator (DBA).

The DBA is responsible for many critical tasks such as,

Design of the conceptual and physical schema.

Security and authorization.

Data availability and recovery from failures.

Application programmers:

Application programmers are computer professionals who
interact with the DBMS through application programs.

Sophisticated users:

Users include engineers, scientists, business analysts, and
others who are thoroughly familiar with the facilities of
the DBMS.They interact with the system through queries.

Naive users

Native users are unsophisticated users .They interact with
database by invoking previously written application programs.
They are not aware of details of DBMS.

They deal only with the higher level of abstraction.

Clerical staffs in an organization are naive users.

Users:-The users access the data by using application programs.
Depending on the mode of interaction with a DBMS

database users are classified into three types Data Base
Administrator (DBA),Application Programmer, Sophisticated
user and Naive user.

Procedure:- Procedures are rules and instructions that govern
the design and use of a database. It may include instruction to
start and stop DBMS, backup database, login to database etc.
Relational data model


A relational model represents database as a collection of
relations (tables).

Each relation has a unique name.

A relational model stores data in a tabular form.

Some of the popular RDBMS are Oracle, MYSQL, DB2,
Microsoft SQL Server, Informix, Ingress etc

Edgar Frank Codd (19 August 1923 - 18 April 2003)was an English
computer scientist who invented the relational model for database
management. He was born on the Isle of Portland in England. He
served as a pilot in the Royal Air Force during the Second World War.
In 1948, he joined IBM. He received the Turing Award in 1981. He
died of heart failure at his home in Williams Island, Florida, at the age
of 79 on 18 April 2003.
Terminologies in RDBMS


1)Entity:-An entity is a real world object that is distinguishable
from others such as student, teacher etc.

2)Relation:-A relation is a collection of data in the form of rows
and column. Also called a table.

3)Tuple:-The row in a table is called a tuple. It is also called a
record. A row consist of a complete set of values used to
represent a particular entity.
One Tuple of Student Table

4)Attribute:-A column in a table(Relation) is called an attribute.

Attribute “AdmNo” Attribute “Result” Attribute “Batch”



5)Degree:-The number of columns (attributes) in a table is
called degree.

The degree of the table STUDENT is 6 as it contains 6
attributes(columns)
Cardinality


The number of tuples(rows) in a relation is known as cardinality of
that relation.

Cardinality of table STUDENT is 8 as it contains 8 rows
Domain


A domain is a pool of values from which column values
taken.

For example:-

the domain of the column “Class” contains the names of
classes in that school
Schema


The overall design(Description) or structure of a database is called schema

It is specified during database design.

Schema of a relation specifies Table_name,Name of columns and data type
of each .

Example

Schema of Table named “Student “
STUDENT
(
Admno : integer,
Roll: integer,
Name : character(50),
Batch : character(20),
Marks : decimal,
Result : character(4)
– )

Instance:-The collection of data stored in the database at a
particular moment is called instance. It is also called snapshot or
database state.

In The “instance” of Table Student each row contains all the six
columns.
Keys


A key is an attribute or collection of attributes that uniquely
identifies each record (Tuple) in a table.

A key consisting of one or more attributes is called a composite
key (Compound Key).

Different types of Keys are

Candidate Key

Primary Key

Alternate Key and

Foreign Key
Candidate Key


Set of Attributes which can uniquely identify a tuple

A table May contain more than one candidate key

Candidate Key can be a single attribute or combination of
attributes(composite key)

Primary Key is selected from Candidate Key

Example :

Candidate Keys of STUDENT table

1. AdmNo

2. RollNo + Name + Mark
Primary key


A primary key is a candidate key which is used to uniquely
identify each row in a table.

A table can have only one primary key.

It cannot contain null value and duplicate value.

Example:

AccountNumber for Bank

AdmissionNumber for School

RegisterNumber for Exam

AcNo + LoanNo for Loan etc.
Alternate key


A candidate key that is not selected as the primary key is
called an alternate key.


Only one candidate key will be selected as Primary key.
Foreign key


A key in a table which is the primary key of another table.

It is used to join two tables together. It is also called reference key.

BatchCode is Foriegn Key BatchCode is Primary Key


Super Key


A Super key is a set of one or more columns in a table for which
no two rows can have the same value.

For Example Name and Address can form a Super Key in the
Students table.

6)Cardinality:-The number of rows (tuples) in a table is called
cardinality.

7)Domain:-The set of possible values for a column(Attribute) is
called domain.

8)Schema:-The overall design(Description) or structure of a
database is called schema. In RDBMS schema of a relation

specifies its name, name and type of each column.

9) Instance:-The collection of data stored in the database at a
particular moment is called instance. It is also called snapshot or
database state.
Relational Algebra


The collection of operations that is used to manipulate the
entire relations of a database

Operations in RDBMS are done using structured query
language

It takes one or two relations as input and produces a new
relation as the result.

These operations are performed with the help of special
language called query language associated with the
relational model.
The fundamental operations are


SELECT(σ)

PROJECT(π)

UNION(U)

INTERSECTION(∩)

SET DIFFERENCE(-)

CARTESIAN PRODUCT (x)
Comparison and Logical operators


< - less than

<= - less than or equal to

> - greater than

>= - greater than or equal to

= - equal to

<> - not equal to

Logical operators to construct composite conditions

∨ - OR

∧ - AND

! - NOT
SELECT operation


Used to select rows from a relation that satisfies a given user
defined condition.

Denoted by Lower Case letter Sigma ( σ ).

General format of SELECT operation.

σ condition (relation)

Example for SELECT operation

To select all the students who are eligible for higher studies.
σ ( STUDENT )
Result="EHS"

Input Table
Output

To select all the students in the Commerce batch who are failed.
σ ( STUDENT )
Result="NHS" ∧ Batch="Commerce"

Output

Input Table
PROJECT operation


Selects certain attributes from the table and forms a new relation.

Selected columns can be retrieved and form a new relation

It is denoted by lower case letter π .

The general format of project operation

π (Relation)
A1, A2,...., An

(Note : here A1,A2 ... etc are Attribute( Column) names

Select Name, Result and Marks attributes from STUDENT
relation.
π (STUDENT)
Name,Marks,Result
Input Table Output table
Nested operation


SELECT operation inside PROJECT operation

To select admission number and name of students who are
Eligible for Higher Studies.
Π ( σ result="EHS" ( STUDENT ))
AdmNo, Name
UNION operation


A binary operation that returns a relation containing all tuples
appearing in first relation or second relation or in both relations.

It is denoted by ∪.

The two relations must be union-compatible ie both relations
contain same number attributes and attributes have same domain.

Schema of resultant relation will be identical to the schema of
first relation
Example for Union Operation

ARTS U SPORTS
INTERSECTION operation


It is binary operation.

It returns a relation containing the tuples appearing in both of the
two specified relations.

It is denoted by ∩ .

The two relations must be union-compatible.

The schema of the resulting relation is identical to the schema of
the first relation.

ARTS ∩ SPORTS

=
SET DIFFERENCE operation

It is a binary operation.

It returns a relation containing the tuples appearing in the first
relation but not in the second relation.

It is denoted by - (minus).

The two relations must be union-compatible.

The schema of the result is identical to the schema of the first
relation.

_ =
CARTESIAN PRODUCT


It returns a relation consisting of all possible combinations of
tuples from two relations.

It is a binary operation.

Degree of new relation equal to the sum of the degrees of the two
relations .

The cardinality new relation is the product of the number of tuples
of the two relations.

It is denoted by × (cross).

It is also called CROSS PRODUCT .

All the tuples of the first relation are concatenated with tuples of
the second relation to form tuples of the new relation.
STUDENT TEACHER

=
THANK YOU
SIRAJ.F.M
HSST COMPUTER SCIENCE
AKGS GHSS PERALASSERY

You might also like