0% found this document useful (0 votes)
61 views66 pages

1 DBMS - U1 - G12 Part 1

DBMS

Uploaded by

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

1 DBMS - U1 - G12 Part 1

DBMS

Uploaded by

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

Unit 1

Data Base Management System

Prepared by

Engr. Prachandra Ram Shrestha


Name of Your text book:
Essentials Of Computer Science

Asmita Publication

by
Er. Prachandra Ram Shrestha
Roshan Bhusal
Ridip Khanal
Learning Objectives :

 To know about data, information and database.


 Introduce Database Management System (DBMS)
with its aspects.
 State the advantages of using DBMS.
 Define Data Definition Language (DDL) and Data
Manipulation Language (DML).
Learning Objectives :

 Introduce and use database model.


 State the concept of normalization.
 Compare between centralized and distributed
database.
 Introduce database security and apply it.
History of Database System
Database have become a dominant tool in business computing
World for efficient decision making.

It is the engine of information system.


The stages of evolution are:
Prior to 1970: File system

1970-1979: Hierarchical or network model DB systems.

1980-1989: Relational database systems.

1990-1999: Client/server database system.

1995 onwards: Internet/Intranet.


Introduction: DATA

 Data and database technology are having a major


impact on the growing use of computers.

 Data is a raw fact of person, place, object, event or


concept.

 Data are the crucial raw material for any meaningful


information.

 Meaningful information is only possible after


processing such a raw data.
DATA

 Data is a representation of facts, concepts,


or instructions in a formalized manner suitable
for communication, interpretation, or
processing by humans or by automatic means.
 Example: number of students in a class, mark
stored by the student etc.
Introduction: INFORMATION

 Data is used to generate information by


processing it.
 Information is a meaningful data i.e. it is the
output of the data processing operation.
 It is presented in a systematic way so that it
carries specific meaning when presented.
Introduction: INFORMATION

 For example: The marks obtained by the


students is: 60, 70, 55, 45, 90 is a data.
 Using the above data, information can be
retrieved:
 The average mark stored by the students is 64.
 The highest mark is 90 and the lowest mark is
45.
Definition of Database:

 Database is a collection of determined,


integrated, shared data that can be processed
by one or more application systems. Or,

 A database is a collection of interrelated data


of certain place or person or things in such a
way that it can be easily accessed by an
application program like DBMS.
Major uses of database application
software:

 1. Allow to store data in database.


 2. Accessing data, when it is required.
 3. Allow to updating & modifying data.
 4. To allow delete or remove data.
 5. Providing securing on the data so that it
can be used only by the authorized persons.
Major uses of database application
software:

 6. Sharing of data for concurrent access.


 7. Maintaining accuracy of the data.

8.Enforcing standards or rules to access the data.


 9. Reducing data redundancy.
 10. Providing timely and accurate information.
Figure: Block Diagram showing DBMS,
(Database, End User and their Connections)
Database structure

Application request Metadata


End User

Data
Customer

DBMS
Database Management
End User
Inventory
System Data

Invoice
End User Application request

Data Products
DBMS:
 A DBMS is a set of programs that manages the
database files.
 The DBMS allows accessing the files, updating the
records, and retrieving data as requested.
 The DBMS acts as an interface between the
application program and the data in the database.
 Example of popular software are: Microsoft
Access, Oracle, MySQL, SQL Server, dBase, FoxPro.
Application area of DBMS :

It is used in the field:


Banking records of the customers,
Mark sheet of students,
payroll sheets and
product records of the shopping centers.
Data storage hierarchy or
Components of a file
Components of a file
A bit is the smallest unit of memory. It can be either 0 or 1.
A character is the collection of 8 bits. It represents
an alphabet, number and anyone sign or symbol.
A=01000001 B= 01000010
A field (data item /data element) holds single facts or
attribute to an entity. It is often referred to as an attribute.
A record is a collection of related fields which represents
a complete unit of information.
A file is a collection of related records.
A database is a collection of integrated files.
Some of the Objectives of DBMS :

1. To provide a storage area for the mass


amount of relevant data.
2. To make access to the data easy for the end-
user.
3. To provide prompt response to the user's
request for data.
4. To make the latest modification to the
database available immediately.
Some of the Objectives of DBMS :

5. To eliminate data redundancy (duplication of


data).

6. To allow multiple users to be active at one


time.

7. To allow the growth of the database.

8. To protect the data from the physical harm


and unauthorized access.
Relationship between field, record and file

Database

... ... ... ... ... ... ... File_n


File1

... ... Record_n


Record1 Record_n Record1

Field1 … Field_n Field1 … Field_n Field1 … Field_n … Field_n


… … …
Field1 …
… … … …
Advantages and disadvantages of using DBMS

1. Data can be shared (concurrent access of data):


2. Reduce data Redundancy:
3. Integrity can be maintained:
4. Data Independence:
5. Data availability:
6. Standard can be enforced:
7. Security can be improved:
8. Inconsistency can be avoided:
9. Providing multiple user interfaces:
10. Providing backup and recovery:
Advantages and disadvantages of using DBMS
Disadvantages of using DBMS

1. The initial investment is high for implementing


hardware, software (implementing DBMS software) and
training.

2. Proper training is required for staff to work


properly in the database system per annum.

3. When some fault occurs in one part of the


database, it affects the other parts as well.

4. It is complex to understand and implement.


Disadvantages of using DBMS E2
Disadvantages of using DBMS

5. The overhead cost of providing security, recovery, and


integrity functions.
6. Cost for the hardware- upgrade to allow for the extensive
program and the maintenance of the hardware, software,
backup, recovery remain forever.
7. The problem arises if the database is not properly designed
or if the database application system is not properly
implemented.
8. An additional cost is for migration from a traditionally
separate application environment to an interpreted one.
SQL (Structured Query Language)
SQL (Structured Query Language)

A DBMS provides one or more specialized programming


languages called database languages. One of them is
SQL- as the standard database language.
SQL is the relational language for the end user. It offers a
mechanism of universal database access.
SQL allows users to retrieve data from the database
without having detailed information about the structure
of the records and without being concerned about the
DBMS processes.
SQL (Structured Query Language) continue

It is used as a middle and a standard in accessing a


large number of different types of database systems.
It contains the statements that describe the data
contained in the database.
There are many types of SQL statements, but the most
commonly used two types are :
one to specify the database schema and the other to
express database queries and updates.
Those two main languages provided by DBMS are:

1. DDL (Data Definition Language) 2. DML (Data Manipulation Language)


1. DDL (Data Definition Language) :

DDL is used by the database designers and programmers


to specify the content and structure of the database.

It is used to define the physical characteristics of records.

It is a link between the logical and physical structures of the


database.

The logical structure of the database is called schema.


Those two main languages provided by DBMS are:
2. DML (Data Manipulation Language)

DML provides the techniques for processing the


database, such as retrieval, sorting, display and
deletion of data or record.

It provides a user to query a database and receive


summary reports.

It is integrated with other programming languages so


as to implement sophisticated database functions.

DML writes programs to build updates and retrieve


data from the database.
2. DML (Data Manipulation Language)

There are basically two types of DML

i. Procedural DML: It requires a user to specify


what data are needed and how to get those data.

ii. Non-procedural DML: It requires a user to


specify what data are needed without specifying
how to get those data.
Example for SQL:
2. DML (Data Manipulation Language)

Example for SQL:


The SQL Query for selecting only the Cus_Name, Cus_Address
and Cus_Telno having Cus_Address as Kathmandu will be:

SELECT Customer_info.Cus_Name, Customer_info.Cus_Address,


Customer_info.Cus_Telno
FROM Customer_info
WHERE (((Customer_info.Cus_Address)="Kathmandu"));,

The result of running the above query will be


Data Dictionary

A data dictionary is a file that contains metadata (“Data


about data”).
The data dictionary is checked before actual data are
read or modified in the database system.
A language that is used to define the data dictionary is
called data dictionary language.
A comprehensive dictionary also includes cross-
reference, that is which user require which report, which
user requirements which form and so on.
Data Dictionary

A data dictionary is a file that contains metadata (“Data about data”).


Database Model

The database model describes the structure of a


database.
It is a collection of conceptual tools for describing data,
relationship etc.
It defines how the data are stored and accessed.
Types of Database Model:
The different database models are:
1. Hierarchical Database Model
2. Network Database Model
3. Relational Database Model data
Types of Database Model:
1. Hierarchical Database Model

In a hierarchical database model, records are logically


arranged in an inverted tree pattern.
1. Hierarchical Database Model

All records in the hierarchy are called nodes.

Each node is related to the others in a parent-child


relationship.

Each parent record may have one or more child


records, each can have only one parent.

The top-level record in the hierarchy is called the


root record.
The advantages of hierarchical DB model:

It is the easiest model of the database.

A database owner is more secure because nobody else


can see and modify a child without consulting its parent.

Searching is fast and easy if the parent is known.

It is very efficient in handling ‘One-to-many’ relationship.

It helps to build complex system from simple


components.
The disadvantages of hierarchical DB model:

It is old-fashioned, outdated database model.


It is non-flexible database model (Modification and addition of
child without consulting the parent is an impossible or very complex
process).

It can’t handle ‘Many- to-Many’ relationships.


It increases data redundancy as same data can be saved
in different places.
When a parent node is deleted, all the children’s nodes is
deleted automatically.
2. Network Database Model:

Network database model is a modified version of the


hierarchical database.
In network database structure each node may have
several parents.
A network database model views all records in sets.
The network database model has a higher level of flexibility
than hierarchical.
2. Network Database Model:

It is easier to restructure the information stored in this


structure, since the path of relationship enables to store
member records in an arbitrary manner.

Operation and maintenance of this structure become


complicated, as the number of points in the network
increases.

It is less user-friendly when compared to the hierarchical


structure.
2. Network Database Model:
2. Advantage of Network Database Model:

Some of the advantages are:

It is more flexible than hierarchical model because


accepts ‘many-to-many’ relationship.

It reduces redundancy because data shouldn’t be


repeated if same data is needed.

Searching is fast because of multidirectional


pointers.
2. Disadvantage of Network Database Model:

Some of the disadvantages are:

It is one of the complex database models.

It needs larger programs to handle the relationships.

Pointers needed in this model increase the over head


of storage.

It is less secure compared to the hierarchical model,


as it is open to all.
3. Relational Database Model :

In this model, data are arranged in two- dimensional


tabular form that are easy to develop and understand.

This type of model can also be described


mathematically. So, it is easy for most of them to
understand the structure used in a relational database.

The name relational database model is derived from


the fact that each table represents a relation, and each
row of the table corresponds to a single record of the
database.
3. Relational Database Model :

It is highly flexible to program and retrieve data.


It can be efficiently used even with a computer that
has limited memory and processing capability.
It is much easier to use since it enables the computer
system to accommodate different types of inquiries in
an efficient manner.
Its processing efficiency is comparatively low; no
processing can be done without establishing the data
relationships.
3. Relational Database Model :

A relational database consists of a collection


of tables, each of which is assigned a unique
name.
A row in a table represents a relationship
among a set of values.
3. Relational Database Model :

Relations represent facts describing a set of


real-world entities.
In a relation, we represent one entity per row
and one attribute per column.
Table name and the column names are used
to help in interpreting the meaning of the
values in each row of relation.
Example of Relational Database Model :
Relational DB:

A relational database consists of a collection of tables, each


of which is assigned a unique name.
A row in a table represents a relationship among a set of
values.
Relations represent facts describing a set of real-world
entities.
In a relation, we represent one entity per row and one
attribute per column.
Table name and the column names are used to help in
interpreting the meaning of the values in each row of
relation.
example of Relational :
Different features of a relation:

1. Attributes: Attribute is the name of a column in a


relation.

The attributes of the relation STUDENT are


Roll_Number, Student_Name, DOB, etc.

Similarly, the attributes of the relation COURSE are


Course_Number, Course_Name, Room, Day and
Hr.

No two attributes in a relation can have the same


name.
Different features of a relation:

2. Domain: Domain defines the set of all values that


an attribute takes on. In STUDENT table, the
values in the column Roll-number are of a specific
form.

The set of all possible values that an attribute takes is


called the domain of the attributes.

The domain of Roll-Number is the set of all Roll-


Number in the class. A domain can be viewed as a
data type.
Different features of a relation:

It can be possibly a simple system-defined type like


integer or character or more generally user-defined
data type.
It is essentially all possible values that a column can
take. It is possible that several attributes in a relation
can have the same domain.
1. NULL value: Null value indicated that the
value for the corresponding attribute is either not
available or not applicable. An attribute used as the
primary key shouldn’t have a NULL value.
Different features of a relation:

2. Tuple: Every row of a relation is called a tuple.


Hence relation is a set of tuples.

Each tuple contains exactly one value for each


attribute.

There cannot be two identical tuples in a relation.

A set cannot have duplicate elements. A tuple is


also called as a record.
Advantages of RD Model:

Some of the advantages of relational database model


are:

1.Since one table is linked with other, some common


fields and rules implemented on one table can easily
be implemented to another.

2.It is very less data redundancy.

3.Normalization of the database is possible.

4.Rapid processing of database is possible.


Disadvantages of RD Model:

Some of the disadvantages of relational


database model are:

1.It is more complex than other models.

2.Too many rules make database non-user-


friendly.
1.6 RDBMS (Relational Database Management System)

Many early database applications and some current low-


end applications could access and manipulate only one
table at a time.

Each table was stored in its own file. In these cases, there
was no reason to use the term table because the table and
the database were one and the same.

Very often the table was simply called a file or just the
database. This type of databases using a single file for a
table is called flat-file database.
1.6 RDBMS (Relational Database Management System)

The flat-file database is useful for single user and small


systems. When the system is large, the flat-file database is
very difficult to maintain because when adding, deleting or
editing any field, we have to make changes in every file that
contains the same field. So, to eliminate the drawbacks,
relational database management system was developed.
In relational database management system, the database is
made up of a set of tables. The data of one table is related to
other tables through a common field.
Advantages of Database system compared to the flat-files system :

The flat-file database is useful for single user and small


systems. When the system is large, the flat-file database is
very difficult to maintain because when adding, deleting or
editing any field, we have to make changes in every file that
contains the same field. So, to eliminate the drawbacks,
relational database management system was developed.
In relational database management system, the database is
made up of a set of tables. The data of one table is related to
other tables through a common field.
1.7 Entity, Attribute and Relationship:

Entity : An entity is a name of ‘thing’ or ‘person’ or ‘object’ in the


real world that is distinguishable from all other objects.
An entity is an existing thing in the system the real-world
object or thing used in the database.
For example, student, employee, book, loan, zone, and
account is an entity.
An entity set is a set of entities of the same type that share
the same properties or attributes.
For example, the set loan might represent the set of all loans
(house loan, car loan, personal loan) provided by a
particular bank.
1.7 Entity, Attribute and Relationship:

Attribute : The properties that characterize an entity set are


called its attribute. It is the descriptive properties possessed
by each member of an entity set.

For example, the possible attributes of the customer


entity can be Customer_id, Customer_name,
Customer_street, Customer_city, Customer_telno, and
Customer_email.
Have a good day!

We will continue DBMS


in
next class.

You might also like