DATA Base System Class Notes 2024
DATA Base System Class Notes 2024
DMS-22319
Unit-I
Database System Concept
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.
Smt. J. P. Dandale
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.
DBMS also provides protection and security to the databases. It also maintains data
consistency in case of multiple users.
o MySql
o Oracle
o SQL Server
o IBM DB2
o PostgreSQL
o Amazon SimpleDB (cloud based) etc.
DMS-22319 Page 2
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.
▪ 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.
3. Data isolation
4. Integrity problems
5. Atomicity problems
DMS-22319 Page 3
1.5. Application of Database
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.
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
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.
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.
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 Page 4
▪ Telecommunications
▪ 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.
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 Page 5
▪ 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.
DMS-22319 Page 6
• 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.
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 Page 7
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 Page 8
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.
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 -
DMS-22319 Page 9
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 Page 10
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.
DMS-22319 Page 11
4. Overall structure of DBMS(S-19)
1. Query processor :
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 Page 12
Fig- Overall Structure of DBMS
DMS-22319 Page 13
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 Page 14
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
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 Page 15
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
DMS-22319 Page 16
Q. State difference between relational and hierarchical model.(S-19)-4M.
6. Components of ER Model
DMS-22319 Page 17
As shown in the above diagram, an ER diagram has three main components:
1. Entity
2. Attribute
3. Relationship
6.1. Entity
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 Page 18
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
DMS-22319 Page 19
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 Page 20
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.
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.
DMS-22319 Page 21
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
Sol-
DMS-22319 Page 22