Download as pdf or txt
Download as pdf or txt
You are on page 1of 22

Second Year Diploma Courses in Computer Science & Engineering

/Computer Engineering/Computer Technology/Information


Technology Branch.

Database
Management System
As per MSBTE ‘I’ Scheme Syllabus
DMS-22319
Unit-I
Database System Concept
Total Marks- 12
Contents:
1.1 Concept of Data, database, DBMS, advantages of DBMS, over file Processing system,
Application of database.
1.2 Three level architecture for database system.
1.3 Data abstraction: Different level of Data abstraction, Instance and schema, Data
independence- Logical and Physical independence.
1.4 Overall Structure of DBMS.
1.5 Data Modelling: Record based logical model- Relation, Network, Hierarchical.
1.6 Data Modelling using the E-R Model: Entity Relationship Model, Strong Entity set, Weak
Entity set, Types of Attributes, E-R Diagrams.

Prof. Gunwant V. Mankar


B.E(IT), M.Tech(CSE), AMIE, MIAEng, MSCI
Head of Department & Assistant Professor,
(Ballarpur Institute of Technology,Ballarpur.)
e-mail:- info@gunwantmankar.com
Website:- www.gunwantmankar.com
Unit-I Database System Concept

Unit-I Database system Concept

1. Concept of Data, database, DBMS, advantages of DBMS, over file


processing system, Application of database.

1.1. Data
In computer science, data is information that has been translated into a form that is
efficient for movement or processing. In a 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.

1.2. Database(DB)
A database is a collection of information or facts that is organized so that it can be
easily accessed, managed and updated.
Data is organized into rows, columns and tables, and it is indexed to make it easier
to find relevant information.

1.3. Database Management System (DBMS)

A DBMS is a software that allows creation, definition and manipulation of


database, allowing users to store, process and analyse data easily. DBMS provides us with
an interface or a tool, to perform various operations like creating database, storing data in
it, updating data, creating tables in the database and a lot more.

DBMS also provides protection and security to the databases. It also maintains data
consistency in case of multiple users.

Here are some examples of popular DBMS used these days:

o MySql
o Oracle
o SQL Server
o IBM DB2
o PostgreSQL
o Amazon SimpleDB (cloud based) etc.
DMS-22319 www.gunwantmankar.com Page 2
Unit-I Database System Concept

1.3.1. Disadvantages of DBMS

 It's Complexity
 Except MySQL, which is open source, licensed DBMSs are generally costly.
 They are large in size.

1.4. Advantages of DBMS over file Processing system


Q. List any four advantages of DBMS. (S-19)

 Controlling Redundancy
 Maintaining Integrity
 Inconsistency can be avoided
 Data can be shared
 Restricting unauthorized access
 Providing Backup and Recovery
 Concurrency Control
 Better security.
 Data searching can be provided.
 Simplicity
 Back up and Recovery.

Q. List disadvantages of typical file processing system.(W-18)

Disadvantages of file processing system

1. Data redundancy and inconsistency

2. Difficulty in accessing data

3. Data isolation

4. Integrity problems

5. Atomicity problems

DMS-22319 www.gunwantmankar.com Page 3


Unit-I Database System Concept

1.5. Application of Database

 Railway Reservation System

Database is required to keep record of ticket booking, train’s departure and arrival
status. Also if trains get late then people get to know it through database update.

 Library Management System

There are thousands of books in the library so it is very difficult to keep record of all
the books in a copy or register. So DBMS used to maintain all the information relate
to book issue dates, name of the book, author and availability of the book.

 Banking

We make thousands of transactions through banks daily and we can do this


without going to the bank. So how banking has become so easy that by sitting at home
we can send or get money through banks. That is all possible just because of DBMS
that manages all the bank transactions.

 Universities and colleges

Examinations are done online today and universities and colleges maintain all
these records through DBMS. Student’s registrations details, results, courses and
grades all the information are stored in database.

 Credit card transactions

For purchase of credit cards and all the other transactions are made possible
only by DBMS. A credit card holder knows the importance of their information that
all are secured through DBMS.

 Social Media Sites

We all are on social media websites to share our views and connect with our
friends. Daily millions of users signed up for these social media accounts like
facebook, twitter, pinterest and Google plus. But how all the information of users are
stored and how we become able to connect to other people, yes this all because
DBMS.
DMS-22319 www.gunwantmankar.com Page 4
Unit-I Database System Concept

 Telecommunications

Any telecommunication company cannot even think about their business


without DBMS. DBMS is must for these companies to store the call details and
monthly post paid bills.

 Finance

Those days have gone far when information related to money was stored in
registers and files. Today the time has totally changed because there are lots f thing to
do with finance like storing sales, holding information and finance statement
management etc.

 Military

Military keeps records of millions of soldiers and it has millions of files that
should be keep secured and safe. As DBMS provides a big security assurance to the
military information so it is widely used in militaries. One can easily search for all the
information about anyone within seconds with the help of DBMS.

 Online Shopping

Online shopping has become a big trend of these days. No one wants to go to
shops and waste his time. Everyone wants to shop from home. So all these products
are added and sold only with the help of DBMS. Purchase information, invoice bills
and payment, all of these are done with the help of DBMS.

 Human Resource Management

Big firms have many workers working under them. Human resource
management department keeps records of each employee’s salary, tax and work
through DBMS.

 Manufacturing

Manufacturing companies make products and sales them on the daily basis. To
keep records of all the details about the products like quantity, bills, purchase, supply
chain management, DBMS is used.

DMS-22319 www.gunwantmankar.com Page 5


Unit-I Database System Concept

 Airline Reservation system

Same as railway reservation system, airline also needs DBMS to keep records
of flights arrival, departure and delay status.

So in short, one can say the DBMS is used everywhere around us and we
cannot rely without DBMS.

2. Three level architecture for database system.

In the above diagram,

 It shows the architecture of DBMS.


 Mapping is the process of transforming request response between various
database levels of architecture.
 Mapping is not good for small database, because it takes more time.

DMS-22319 www.gunwantmankar.com Page 6


Unit-I Database System Concept

 In External / Conceptual mapping, DBMS transforms a request on an external


schema against the conceptual schema.
 In Conceptual / Internal mapping, it is necessary to transform the request from
the conceptual to internal levels.
2.1. Physical Level
 Physical level describes the physical storage structure of data in database.
 It is also known as Internal Level.
 This level is very close to physical storage of data.
 At lowest level, it is stored in the form of bits with the physical addresses on
the secondary storage device.
 At highest level, it can be viewed in the form of files.
 The internal schema defines the various stored data types. It uses a physical
data model.
2.2. Conceptual Level
 Conceptual level describes the structure of the whole database for a group of
users.
 It is also called as the data model.
 Conceptual schema is a representation of the entire content of the database.
 These schema contains all the information to build relevant external records.
 It hides the internal details of physical storage.
2.3. External Level
 External level is related to the data which is viewed by individual end users.
 This level includes a no. of user views or external schemas.
 This level is closest to the user.
 External view describes the segment of the database that is required for a
particular user group and hides the rest of the database from that user group.

3. Data Abstraction: Different Levels of Data Abstraction.

Database systems are made-up of complex data structures. To ease the user
interaction with database, the developers hide internal irrelevant details from users.
This process of hiding irrelevant details from user is called data abstraction.

DMS-22319 www.gunwantmankar.com Page 7


Unit-I Database System Concept

We have three levels of abstraction:


Physical level:
This is the lowest level of data abstraction. It describes how data is actually
stored in database. You can get the complex data structure details at this level.
Logical level:
This is the middle level of 3-level data abstraction architecture. It describes
what data is stored in database.
View level:
Highest level of data abstraction. This level describes the user interaction with
database system.
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.

DMS-22319 www.gunwantmankar.com Page 8


Unit-I Database System Concept

3.1. Define i)Data Abstraction ii)Data Redundancy (W-18)

i) Data Abstraction :
Many end users are not computer trained so it is needed to hide complex data
structures from them.
Hiding complexity of data structures from end user through different levels is
known as data abstraction.
It has 3 levels
a. Physical level
b. logical level
c. view level
ii) Data redundancy :
The repetition of information is known as redundancy .This redundancy leads to
higher storage and access cost.
It may lead to data inconsistency, that is different copies of the same data may have
different values.

3.2. Instance and Schema (S-19) (Def-2M)

Solution-

(i) Instance: The data stored in database at a particular moment of time is called instance
of database.

(ii) Schema: Design of a database is called the schema. Schema is of three types:
Physical schema, logical schema and view schema.

3.2.1. Schema -

Definition of schema: Design of a database is called the schema. Schema is of


three types: Physical schema, logical schema and view schema.
For example: In the following diagram, we have a schema that shows the
relationship between three tables: Course, Student and Section. The diagram only shows
the design of the database, it doesn’t show the data present in those tables. Schema is only
a structural view(design) of a database as shown in the diagram below.

DMS-22319 www.gunwantmankar.com Page 9


Unit-I Database System Concept

The design of a database at physical level is called physical schema, how the data
stored in blocks of storage is described at this level.
Design of database at logical level is called logical schema, programmers and
database administrators work at this level, at this level data can be described as certain
types of data records gets stored in data structures, however the internal details such as
implementation of data structure is hidden at this level (available at physical level).
Design of database at view level is called view schema. This generally describes
end user interaction with database systems.

3.2.2. Instance
Definition of instance: The data stored in database at a particular moment of time
is called instance of database. Database schema defines the variable declarations in tables
that belong to a particular database; the value of these variables at a moment of time is
called the instance of that database.
For example, lets say we have a single table student in the database, today the
table has 100 records, so today the instance of the database has 100 records. Lets say we
are going to add another 100 records in this table by tomorrow so the instance of database
tomorrow will have 200 records in table. In short, at a particular moment the data stored
in database is called the instance, that changes over time when we add or delete data from
the database.

DMS-22319 www.gunwantmankar.com Page 10


Unit-I Database System Concept

3.3. Data Independence


Data independence is ability to modify a schema definition in one level without
affecting a schema definition in the next higher level.
There are two levels of data independence:
1. Physical Data Independence
2. Logical Data Independence
These are described below:
1. Physical Data Independence:
 Physical Data Independence is the ability to modify the physical schema
without requiring any change in application programs.
 Modifications at the internal levels are occasionally necessary to improve
performance. possible modifications at internal levels are change in file
structures, compression techniques, hashing algorithms, storage devices, etc.
 Physical data independence separates conceptual levels from the internal levels.
 This allows to provide a logical description of the database without the need to
specify physical structures.
 Comparatively, it is easy to achieve physical data independence.

2. Logical Data Independence:

 Logical data independence is ability to modify the conceptual schema without


requiring any change in application programs.
 Modification at the logical levels are necessary whenever the logical structures
of the database is altered.
 Logical data independence separates external level from the conceptual view.
 Comparatively it is difficult to achieve logical data independence.
 Application programs are heavily dependent on logical structures of the data
they access.so any change in logical structure also requires programs to
change.

DMS-22319 www.gunwantmankar.com Page 11


Unit-I Database System Concept

4. Overall structure of DBMS(S-19)

Q. Explain overall structure of DBMS with the help of diagram (S-19)

Components of DBMS structure are classified in 3 categories as:

1. Query processor :

Embedded DML pre compiler: It converts DML statements embedded in application.


Program to normal procedural calls in host language.
DML Compiler: It translates DML statements of high level language into low level
instruction that a query evaluation engine understands.
DDL interpreter: It interprets DDL statements and records them in a set of tables
containing metadata.
Query evaluation Engine: It executes low level instructions generated by DML
compiler and issued by query processor to select efficient ways to execute query.
DDL interpreter. It has following components,

2. Storage Manager Components :

Transaction manager: It ensures that the database remains in consistent state despite
of the system failure and that concurrent transaction execution proceeds without
conflicting.
File Manager: It manages the allocation of space on disk storage and data structures
used to represent information stored on disk Buffer Manager: It is responsible for
fetching data from disk storage into main memory and deciding what data to cache
memory.

3. Disk storage :
Data files: It stores the database. Data Dictionary: It stores metadata that hold
particular values. Indices: Provide fast access to data items that hold particular values.
Statistical data: It stores statistical information about the data in the database.

DMS-22319 www.gunwantmankar.com Page 12


Unit-I Database System Concept

Fig- Overall Structure of DBMS

4.1. Database Administrator

Q . Explain the four roles of database administrator.(W-18).


1. Schema Definition The Database Administrator creates the database schema by
executing DDL statements. Schema includes the logical structure of database table
(Relation) like data types of attributes, length of attributes, integrity constraints etc.
2. Storage structure and access method definition The DBA creates appropriate
storage structures and access methods by writing a set of definitions which is translated
by data storage and DDL compiler.
3. Schema and physical organization modification DBA writes set of definitions to
modify the database schema or description of physical storage organization

DMS-22319 www.gunwantmankar.com Page 13


Unit-I Database System Concept

4. Granting authorization for data access -The DBA provides different access
rights to the users according to their level. Ordinary users might have highly restricted
access to data, while you go up in the hierarchy to the administrator, you will get more
access rights. Integrity constraints specifications: Integrity constraints are written by
DBA and they are stored in a special file which is accessed by database manager while
updating data.
5. Routine Maintenance some of the routine maintenance activities of a DBA is
given below.
(i) Taking backup of database periodically
(ii) Ensuring enough disk space is available all the time.
(iii) Monitoring jobs running on the database.
(iv) Ensure that performance is not degraded by some expensive task submitted by
some users.
6. Integrity- constraint specification: Integrity constraints are written by DBA and
they are stored in a special file, which is accessed by database manager, while updating
the data.

5. Data model

A Database model defines the logical design and structure of a database and
defines how data will be stored, accessed and updated in a database management system.

Types of Model
 Hierarchical Model
 Network Model
 Entity-relationship Model
 Relational Model

DMS-22319 www.gunwantmankar.com Page 14


Unit-I Database System Concept

5.1. Network Model-


In this model data is organised more like a graph, and are allowed to have more
than one parent node.
In this database model data is more related as more relationships are established
in this database model. Also, as the data is more related, hence accessing the data is also
easier and fast. This database model was used to map many-to-many data relationships

5.2. Hierarchical Model

This database model organises data into a tree-like-structure, with a single root,
to which all the other data is linked. The heirarchy starts from the Root data, and
expands like a tree, adding child nodes to the parent nodes.
In this model, a child node will only have a single parent node. This model
efficiently describes many real-world relationships like index of a book, recipes etc.

DMS-22319 www.gunwantmankar.com Page 15


Unit-I Database System Concept

5.3. Entity-relationship Model(E-R)


In this database model, relationships are created by dividing object of interest
into entity and its characteristics into attributes.
Different entities are related using relationships.
E-R Models are defined to represent the relationships into pictorial form to make it
easier for different stakeholders to understand.
This model is good to design a database, which can then be turned into tables in
relational model

5.4. Relational Model


In relational model, the data and relationships are represented by collection of
inter-related tables. Each table is a group of column and rows, where column
represents attribute of an entity and rows represents records.

DMS-22319 www.gunwantmankar.com Page 16


Unit-I Database System Concept

Q. State difference between relational and hierarchical model.(S-19)-4M.

Relational model Hierarchical model.


A database model to manage data A structure of data organized in
as tuples grouped into a tree like model using parent
relations(tables) child relationships.
Arranges data in tree like
Arranges data in tables
Structure.
Represents both “one to many” Represents “one to many”
and”many to many” relationships. Relationship

Easier to access data Difficult to access data


Flexible Less flexible
Example Example

6. Components of ER Model

Rectangle: Represents Entity sets.


Ellipses: Attributes
Diamonds: Relationship Set
Lines: They link attributes to Entity Sets and Entity sets to Relationship Set
Double Ellipses: Multivalued Attributes
Dashed Ellipses: Derived Attributes
Double Rectangles: Weak Entity Sets
Double Lines: Total participation of an entity in a relationship set

DMS-22319 www.gunwantmankar.com Page 17


Unit-I Database System Concept

As shown in the above diagram, an ER diagram has three main components:


1. Entity
2. Attribute
3. Relationship

6.1. Entity

An entity is an object or component of data. An entity is represented as


rectangle in an ER diagram.

For example: In the following ER diagram we have two entities Student and
College and these two entities have many to one relationship as many students study
in a single college.

Weak Entity:
An entity that cannot be uniquely identified by its own attributes and relies on the
relationship with other entity is called weak entity. The weak entity is represented by
a double rectangle.

DMS-22319 www.gunwantmankar.com Page 18


Unit-I Database System Concept

For example – a bank account cannot be uniquely identified without knowing the
bank to which the account belongs, so bank account is a weak entity.

6.2. Attribute
An attribute describes the property of an entity. An attribute is represented as
Oval in an ER diagram. There are four types of attributes:
1. Key attribute
2. Composite attribute
3. Multivalued attribute
4. Derived attribute

6.2.1. Key attribute:


A key attribute can uniquely identify an entity from an entity set. For example,
student roll number can uniquely identify a student from a set of students. Key
attribute is represented by oval same as other attributes however the text of key
attribute is underlined.

6.2.2. Composite attribute:

An attribute that is a combination of other attributes is known as composite


attribute. For example, In student entity, the student address is a composite attribute as
an address is composed of other attributes such as pin code, state, country.

DMS-22319 www.gunwantmankar.com Page 19


Unit-I Database System Concept

6.2.3. Multivalued attribute:


An attribute that can hold multiple values is known as multivalued attribute. It is
represented with double ovals in an ER Diagram. For example – A person can have more
than one phone numbers so the phone number attribute is multivalued.
6.2.4. Derived attribute:
A derived attribute is one whose value is dynamic and derived from another
attribute. It is represented by dashed oval in an ER Diagram. For example – Person age is
a derived attribute as it changes over time and can be derived from another attribute (Date
of birth).
E-R diagram with multivalued and derived attributes:

6.3. Relationship
A relationship is represented by diamond shape in ER diagram, it shows the
relationship among entities. There are four types of relationships:
1. One to One
2. One to Many
3. Many to One
4. Many to Many

DMS-22319 www.gunwantmankar.com Page 20


Unit-I Database System Concept

6.3.1. One to One Relationship


When a single instance of an entity is associated with a single instance of
another entity then it is called one to one relationship.
For example, a person has only one passport and a passport is given to one person.

6.3.2. One to Many Relationship


When a single instance of an entity is associated with more than one instances
of another entity then it is called one to many relationship. For example – a customer
can place many orders but a order cannot be placed by many customers.

6.3.3. Many to One Relationship

When more than one instances of an entity is associated with a single instance of
another entity then it is called many to one relationship. For example – many students can
study in a single college but a student cannot study in many colleges at the same time.

6.3.4. Many to Many Relationship


When more than one instances of an entity is associated with more than one
instances of another entity then it is called many to many relationship. For example, a
can be assigned to many projects and a project can be assigned to many students .

DMS-22319 www.gunwantmankar.com Page 21


Unit-I Database System Concept

Q. Draw an E-R diagram of library management system considering


issue and return, Fine calculation facility. Consider appropriate entities.
(S-19) (6 M)

OR

Draw an E-R diagram of library management system considering


issue and return, fine calculation facility, also show primary key, weak
entity and strong entity. (W-18) (6 M)

Sol-

End of Chapter No.1....

DMS-22319 www.gunwantmankar.com Page 22

You might also like